MySQL Datasource

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

MySQL Datasource

Tim Courtney
Hi all

I've built a small web application that uses MySQL 4.1 as its database.

I tried to follow the tutorial from here
http://jetty.mortbay.org/jetty/plus/datasources.html and have managed to
get everything up and running ok under normal conditions.

But I need some help. I'm confused about which scenario listed on the
tutorial will solve my problem.

If I use #1 then connections are opened & closed fine but under heavy
load with hundreds of db connections occurring I get a
"java.net.SocketException: java.net.BindException: Address already in
use: connect" error (maybe  winXP just can't free up the MySQL port
quick enough?) Connections start working again after a short pause in
testing.

If I use #3 then connections are opened fine but the number of threads
in MySQL never seems to decrease and eventually MySQL stops serving
connections because all its threads have been taken. Am I missing some
parameter that closes idle threads after some period of time?

Sorry if this is a MySQL question - I was just hoping someone else out
there may have already sorted out the best configuration.

Any suggestions would be welcome

Thanks
Tim




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: MySQL Datasource

jan_bartel
Tim,

I don't use Windows, so I can't be of too much help. However, sounds
like a configuration issue on the MYSQL driver. Here's a couple
of links that may be useful in configuring the pooling:

http://dev.mysql.com/doc/connector/j/en/cj-configuration-properties.html

http://www.russellbeattie.com/notebook/1006529.html

cheers
Jan

Tim Courtney wrote:

> Hi all
>
> I've built a small web application that uses MySQL 4.1 as its database.
>
> I tried to follow the tutorial from here
> http://jetty.mortbay.org/jetty/plus/datasources.html and have managed to
> get everything up and running ok under normal conditions.
>
> But I need some help. I'm confused about which scenario listed on the
> tutorial will solve my problem.
>
> If I use #1 then connections are opened & closed fine but under heavy
> load with hundreds of db connections occurring I get a
> "java.net.SocketException: java.net.BindException: Address already in
> use: connect" error (maybe  winXP just can't free up the MySQL port
> quick enough?) Connections start working again after a short pause in
> testing.
>
> If I use #3 then connections are opened fine but the number of threads
> in MySQL never seems to decrease and eventually MySQL stops serving
> connections because all its threads have been taken. Am I missing some
> parameter that closes idle threads after some period of time?
>
> Sorry if this is a MySQL question - I was just hoping someone else out
> there may have already sorted out the best configuration.
>
> Any suggestions would be welcome
>
> Thanks
> Tim
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

RE: Re: MySQL Datasource

Tim Courtney
Thanks Jan

I managed to sort it out.

Using configuration 3 from here
http://jetty.mortbay.org/jetty/plus/datasources.html

And making sure ALL my connections got closed after use, did the trick
(I had a bug in my code)

Cheers



-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Jan
Bartel
Sent: Saturday, 3 September 2005 11:44 PM
To: [hidden email]
Cc: [hidden email]
Subject: [Jetty-support] Re: MySQL Datasource


Tim,

I don't use Windows, so I can't be of too much help. However, sounds
like a configuration issue on the MYSQL driver. Here's a couple of links
that may be useful in configuring the pooling:

http://dev.mysql.com/doc/connector/j/en/cj-configuration-properties.html

http://www.russellbeattie.com/notebook/1006529.html

cheers
Jan

Tim Courtney wrote:

> Hi all
>
> I've built a small web application that uses MySQL 4.1 as its
> database.
>
> I tried to follow the tutorial from here
> http://jetty.mortbay.org/jetty/plus/datasources.html and have managed
> to get everything up and running ok under normal conditions.
>
> But I need some help. I'm confused about which scenario listed on the
> tutorial will solve my problem.
>
> If I use #1 then connections are opened & closed fine but under heavy
> load with hundreds of db connections occurring I get a
> "java.net.SocketException: java.net.BindException: Address already in
> use: connect" error (maybe  winXP just can't free up the MySQL port
> quick enough?) Connections start working again after a short pause in
> testing.
>
> If I use #3 then connections are opened fine but the number of threads

> in MySQL never seems to decrease and eventually MySQL stops serving
> connections because all its threads have been taken. Am I missing some

> parameter that closes idle threads after some period of time?
>
> Sorry if this is a MySQL question - I was just hoping someone else out

> there may have already sorted out the best configuration.
>
> Any suggestions would be welcome
>
> Thanks
> Tim
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices Agile & Plan-Driven Development * Managing Projects & Teams
> * Testing & QA Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf 
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices Agile & Plan-Driven Development * Managing Projects & Teams *
Testing & QA Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Explorer sends UTF-8 not URLEncoded!

Barzilai Spinak
The subject line doesn't tell the whole story but I'll try to explain.

We are developing a web app and serving the JSP pages as UTF-8.
That means, the *response* has:

Content-type: text/html; charset=UTF-8

and the returned page itself has:
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

When there's a form in the page and the browser submits it with a POST,
all the characters higher than 127 are "url encoded" with % notation,
and (since the page was returned as UTF-8) the browser sends the POST
query string in the usual application/x-www-form-urlencoded format, but
also using the UTF-8 encoding.

This means, for example, that an ó (small-case O, with acute accent
U+00F3) is encoded as two bytes and then URL-encoded as %C3%B3.

So far so good. The problem is with GET. If a link is generated which
has a query string after the question mark, and one of the parameter
values has a multibyte UTF-8 character like so:
<a href="/foo/bar?userid=josé">click here</a>

When you "click here" in Firefox it will send userid=jos%C3%A9 and
everything is fine.
However in Internet Explorer, it will send userid=josé with josé
represented in UTF-8 correctly but not URL-encoded.

Well, the thing is, when I get the parameter on the server side, it has
no problem reading the URL-encoded version, but it won't decode the "raw
UTF-8" version correctly.


Before you give me simple answers about setting the character encoding
of the request, I already did that in a Filter, before reading any
parameters as recommended. That solved it for Firefox (because before,
even though it was URL-encoded, it tried to decode the bytes using the
platfotm's default which is windows-1252), however it still doesn't like
"raw utf-8". It stills tries to decode it as windows-1252 even though I
do request.setCharacterEncoding("UTF-8") before reading the param.


The important thing is, we are doing an international webapp, in the
sense that the Jetty server will run on any platform with any native
encoding, and the browser could have any native encoding as well.
That's why we are using UTF-8 in the response.

Ok I'll stop here. If anyone of you can help me, you already know enough
to not need more explaining :-)

Thanks!

BarZ

 Internet Banda Ancha Todo el Dia desde $u 490 por mes!
 ______________________________________________________
 http://www.internet.com.uy - En Uruguay somos internet





-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Martin Roos
hmm . maybe i didnt really manage to read all of this ...

but my web apps do usually output

<a href="/foo/bar?userid=jos%C3%B3">click here</a>

and not

<a href="/foo/bar?userid=josé">click here</a>

(actually this is the first time that i see that someone is giving the
browser a non latin "GET" link and expects the browser to be a
visionaire and encode it correctly by itself).

i never trust the browser, it's always a buggy javascript/request
upmessing beast that users use to make me upset :)

does it work ok if you url-encode the links first by yourself ?

you should always consider the fact that the user my want to copy/paste
the link to somewhere else, if it's encoded, it's fine everywhere else,
if it not encoded and the user copies it to the command line for an
example, he will probably end up with something else in the response
than he would expect.

------
martin


Barzilai Spinak wrote:

> The subject line doesn't tell the whole story but I'll try to explain.
>
> We are developing a web app and serving the JSP pages as UTF-8.
> That means, the *response* has:
>
> Content-type: text/html; charset=UTF-8
>
> and the returned page itself has:
>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>
> When there's a form in the page and the browser submits it with a POST,
> all the characters higher than 127 are "url encoded" with % notation,
> and (since the page was returned as UTF-8) the browser sends the POST
> query string in the usual application/x-www-form-urlencoded format, but
> also using the UTF-8 encoding.
>
> This means, for example, that an ó (small-case O, with acute accent
> U+00F3) is encoded as two bytes and then URL-encoded as %C3%B3.
>
> So far so good. The problem is with GET. If a link is generated which
> has a query string after the question mark, and one of the parameter
> values has a multibyte UTF-8 character like so:
> <a href="/foo/bar?userid=josé">click here</a>
>
> When you "click here" in Firefox it will send userid=jos%C3%A9 and
> everything is fine.
> However in Internet Explorer, it will send userid=josé with josé
> represented in UTF-8 correctly but not URL-encoded.
>
> Well, the thing is, when I get the parameter on the server side, it has
> no problem reading the URL-encoded version, but it won't decode the "raw
> UTF-8" version correctly.
>
>
> Before you give me simple answers about setting the character encoding
> of the request, I already did that in a Filter, before reading any
> parameters as recommended. That solved it for Firefox (because before,
> even though it was URL-encoded, it tried to decode the bytes using the
> platfotm's default which is windows-1252), however it still doesn't like
> "raw utf-8". It stills tries to decode it as windows-1252 even though I
> do request.setCharacterEncoding("UTF-8") before reading the param.
>
>
> The important thing is, we are doing an international webapp, in the
> sense that the Jetty server will run on any platform with any native
> encoding, and the browser could have any native encoding as well.
> That's why we are using UTF-8 in the response.
>
> Ok I'll stop here. If anyone of you can help me, you already know enough
> to not need more explaining :-)
>
> Thanks!
>
> BarZ
>
> Internet Banda Ancha Todo el Dia desde $u 490 por mes!
> ______________________________________________________
> http://www.internet.com.uy - En Uruguay somos internet
>
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Chris Haynes
In reply to this post by Barzilai Spinak
Use

 <form ... accept-charset='UTF-8'>
Chris Haynes"Barzilai Spinak" asked:

The subject line doesn't tell the whole story but I'll try to explain.

We are developing a web app and serving the JSP pages as UTF-8.
That means, the *response* has:

Content-type: text/html; charset=UTF-8

and the returned page itself has:
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

When there's a form in the page and the browser submits it with a POST,
all the characters higher than 127 are "url encoded" with % notation,
and (since the page was returned as UTF-8) the browser sends the POST
query string in the usual application/x-www-form-urlencoded format, but
also using the UTF-8 encoding.

This means, for example, that an ó (small-case O, with acute accent
U+00F3) is encoded as two bytes and then URL-encoded as %C3%B3.

So far so good. The problem is with GET. If a link is generated which
has a query string after the question mark, and one of the parameter
values has a multibyte UTF-8 character like so:
<a href="/foo/bar?userid=josé">click here</a>

When you "click here" in Firefox it will send userid=jos%C3%A9 and
everything is fine.
However in Internet Explorer, it will send userid=josé with josé
represented in UTF-8 correctly but not URL-encoded.

Well, the thing is, when I get the parameter on the server side, it has
no problem reading the URL-encoded version, but it won't decode the "raw
UTF-8" version correctly.


Before you give me simple answers about setting the character encoding
of the request, I already did that in a Filter, before reading any
parameters as recommended. That solved it for Firefox (because before,
even though it was URL-encoded, it tried to decode the bytes using the
platfotm's default which is windows-1252), however it still doesn't like
"raw utf-8". It stills tries to decode it as windows-1252 even though I
do request.setCharacterEncoding("UTF-8") before reading the param.


The important thing is, we are doing an international webapp, in the
sense that the Jetty server will run on any platform with any native
encoding, and the browser could have any native encoding as well.
That's why we are using UTF-8 in the response.

Ok I'll stop here. If anyone of you can help me, you already know enough
to not need more explaining :-)

Thanks!

BarZ

 Internet Banda Ancha Todo el Dia desde $u 490 por mes!
 ______________________________________________________
 http://www.internet.com.uy - En Uruguay somos internet





-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support







-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Bruce Lewis-3
In reply to this post by Barzilai Spinak
Barzilai Spinak <[hidden email]> writes:

> So far so good. The problem is with GET. If a link is generated which
> has a query string after the question mark, and one of the parameter
> values has a multibyte UTF-8 character like so:
> <a href="/foo/bar?userid=josé">click here</a>
>
> When you "click here" in Firefox it will send userid=jos%C3%A9 and
> everything is fine.
> However in Internet Explorer, it will send userid=josé with josé
> represented in UTF-8 correctly but not URL-encoded.

Maybe I'm missing something, but can't this problem simply be solved by
URL-escaping the generated part of the link.

Instead of <a href="/foo/bar?userid=[user]">click here</a>
Do <a href="/foo/bar?userid=[(brl-url-escape user)]">click here</a>

(Pardon the BRL, but I don't know the correct Java code off the top of
my head.)


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Barzilai Spinak
In reply to this post by Martin Roos
Thanks to all who answered. I solved it by URL-encoding the GET
parameters. Like martin and Bruce Lewis suggested.

The thing is that everything was working well until I tried
Explorer which has this non-standar behaviour.
(I know.. most poeple use Explorer anyway so I should always try)

The suggestion by Chris Haynes of using:

<form ... accept-charset='UTF-8'>

did not really apply here because form POSTS were not the
problem but links, or anchors (of the <a href=".."> variety)
which are always sent as GET.

Firefox automatically URL-encodes the GET's, if they are not.
Explorer sends the raw bytes of the charset encoding (utf-8, iso-8859-1,
or whatever) without escaping the higher characters.

Weird stuff. Only problem is that people who write in alphabets other
than English will have very long and weird URLs that can't be
readily understood by a human.
Like this poor Russian guy ВПАДИМИР (Vladimir) whose URL ends in:
...?id=%D0%92%D0%9F%D0%90%D0%94%D0%98%D0%9C%D0%98%D0%A0

Yeah, that's his name in Cyrillic UTF-8 and URL-encoded.
Compare that to the American user:

...?id=ROBERT

Much easier to read haha :-)

Anyway, at least it's working now. Thanks!

BarZ


Chris Haynes"Barzilai Spinak" asked:


martin wrote:

> hmm . maybe i didnt really manage to read all of this ...
>
> but my web apps do usually output
>
> <a href="/foo/bar?userid=jos%C3%B3">click here</a>
>
> and not
>
> <a href="/foo/bar?userid=josé">click here</a>
>
> (actually this is the first time that i see that someone is giving the
> browser a non latin "GET" link and expects the browser to be a
> visionaire and encode it correctly by itself).
>
> i never trust the browser, it's always a buggy javascript/request
> upmessing beast that users use to make me upset :)
>
> does it work ok if you url-encode the links first by yourself ?
>
> you should always consider the fact that the user my want to copy/paste
> the link to somewhere else, if it's encoded, it's fine everywhere else,
> if it not encoded and the user copies it to the command line for an
> example, he will probably end up with something else in the response
> than he would expect.
>
> ------
> martin
>
>
> Barzilai Spinak wrote:
>
>> The subject line doesn't tell the whole story but I'll try to explain.
>>
>> We are developing a web app and serving the JSP pages as UTF-8.
>> That means, the *response* has:
>>
>> Content-type: text/html; charset=UTF-8
>>
>> and the returned page itself has:
>>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>>
>> When there's a form in the page and the browser submits it with a POST,
>> all the characters higher than 127 are "url encoded" with % notation,
>> and (since the page was returned as UTF-8) the browser sends the POST
>> query string in the usual application/x-www-form-urlencoded format,
>> but also using the UTF-8 encoding.
>>
>> This means, for example, that an ó (small-case O, with acute accent
>> U+00F3) is encoded as two bytes and then URL-encoded as %C3%B3.
>>
>> So far so good. The problem is with GET. If a link is generated which
>> has a query string after the question mark, and one of the parameter
>> values has a multibyte UTF-8 character like so:
>> <a href="/foo/bar?userid=josé">click here</a>
>>
>> When you "click here" in Firefox it will send userid=jos%C3%A9 and
>> everything is fine.
>> However in Internet Explorer, it will send userid=josé with josé
>> represented in UTF-8 correctly but not URL-encoded.
>>
>> Well, the thing is, when I get the parameter on the server side, it
>> has no problem reading the URL-encoded version, but it won't decode
>> the "raw UTF-8" version correctly.
>>
>>
>> Before you give me simple answers about setting the character encoding
>> of the request, I already did that in a Filter, before reading any
>> parameters as recommended. That solved it for Firefox (because before,
>> even though it was URL-encoded, it tried to decode the bytes using the
>> platfotm's default which is windows-1252), however it still doesn't
>> like "raw utf-8". It stills tries to decode it as windows-1252 even
>> though I do request.setCharacterEncoding("UTF-8") before reading the
>> param.
>>
>>
>> The important thing is, we are doing an international webapp, in the
>> sense that the Jetty server will run on any platform with any native
>> encoding, and the browser could have any native encoding as well.
>> That's why we are using UTF-8 in the response.
>>
>> Ok I'll stop here. If anyone of you can help me, you already know
>> enough to not need more explaining :-)
>>
>> Thanks!
>>
>> BarZ

 Internet Banda Ancha Todo el Dia desde $u 490 por mes!
 ______________________________________________________
 http://www.internet.com.uy - En Uruguay somos internet





-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Greg Wilkins-5
In reply to this post by Barzilai Spinak

Short answer....

do as Chris suggests and try
  <form ... accept-charset='UTF-8'>

Long answer....

The char encoding of URLs is a mess.  I have been convinced to
change Jetty from using ISO-8859-1 to UTF-8 so many times, I cannot
truely remember which it currently uses..... but I'm guessing
ISO-8859-1, else you would not have a problem.

I think in latest versions of Jetty I use UTF-8.

The problem is that URLs are meant to be able to be written
on the side of a bus, or on a napkin and to be meaningful.
With 8859-1 this is close to possible (a few font problems
with O and 0 maybe).

But with UTF-8 there are many many characters that look
the same.  this can lead to all sorts of problems with URLs,
not the least spoof attacks where you think you are
being linked to www.ebay.com, but the y is really a strange
mozbeslavian character in the upper rangers of UTF-8 that
just happens to look like a y.

So the powers that be, tried and tried and tried to keep
URLs 8859-1 and damn be the rest of the non-english speaking
world.

That approach was not bound to last, and slowly everybody is
switching to UTF-8 URLs.  

But at the end of the day, you can't assume that, so anything
you can do to hint to you browser that it should encode
the content.... will be helpful.

cheers


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Explorer sends UTF-8 not URLEncoded!

Barzilai Spinak
The problem wasn't in the host part of the URL, which would
suffer all these problems that you mention with similar-lookin
characters.

I spent the better part of a week sucking in every documentation and
article I could find about Unicode, UTF-8, character encodings, etc.
It left my head spinning hahah.. it's a whole world in itself indeed.

The problem was in the GET parameters, which comes after the question
mark. And that's where Explorer's different behaviour of not
URL-encoding (that's "percent notation") did all kinds of bad things.
No problems with form POSTS since they are naturally URL-encoded, and
they are UTF-8 encoded also since the web page is served as UTF-8.

So, yes, now I url-encode all the links I generate from JSP which could
have i18n chars, like people's names and stuff like that.
It works like a charm excepto that the poor people from non-latin
charsets will get ugly and long urls with lots of percents!
I guess there's not much to do about it for the time being.

In my project we're using Axis for web services, and Axis itself has
some problems with encodings which were kind of fixed in 1.2.1
but broke other things

It's interesting to see this in software written in Java which is
probably the most complete language/platform today to handle i18n
issues. It shows that even though the standards are pretty good
(UTF-8 is actually quite ingenious and shows good properties),
the subject is so complex and little understood by most programmers
that very few libraries/systems implement it correctly and when
your data is navigating up and down the different layers of APIs and
tiers your characters may get garbled.

You end up doing all kinds of workarounds that may break in the next
version of whatever you are using.

Therefore, I declare that form now on everybody starts writing in
cuneiform!! Yeah :-)

BarZ

Greg Wilkins wrote:

> Short answer....
>
> do as Chris suggests and try
>   <form ... accept-charset='UTF-8'>
>
> Long answer....
>
> The char encoding of URLs is a mess.  I have been convinced to
> change Jetty from using ISO-8859-1 to UTF-8 so many times, I cannot
> truely remember which it currently uses..... but I'm guessing
> ISO-8859-1, else you would not have a problem.
>
> I think in latest versions of Jetty I use UTF-8.
>
> The problem is that URLs are meant to be able to be written
> on the side of a bus, or on a napkin and to be meaningful.
> With 8859-1 this is close to possible (a few font problems
> with O and 0 maybe).
>
> But with UTF-8 there are many many characters that look
> the same.  this can lead to all sorts of problems with URLs,
> not the least spoof attacks where you think you are
> being linked to www.ebay.com, but the y is really a strange
> mozbeslavian character in the upper rangers of UTF-8 that
> just happens to look like a y.
>
> So the powers that be, tried and tried and tried to keep
> URLs 8859-1 and damn be the rest of the non-english speaking
> world.
>
> That approach was not bound to last, and slowly everybody is
> switching to UTF-8 URLs.  
>
> But at the end of the day, you can't assume that, so anything
> you can do to hint to you browser that it should encode
> the content.... will be helpful.
>
> cheers
>

 Internet Banda Ancha Todo el Dia desde $u 490 por mes!
 ______________________________________________________
 http://www.internet.com.uy - En Uruguay somos internet




 Internet Banda Ancha Todo el Dia desde $u 490 por mes!
 ______________________________________________________
 http://www.internet.com.uy - En Uruguay somos internet





-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Chris Haynes
In reply to this post by Greg Wilkins-5
"Greg Wilkins" commented:
>
> The char encoding of URLs is a mess.  I have been convinced to
> change Jetty from using ISO-8859-1 to UTF-8 so many times, I cannot
> truely remember which it currently uses..... but I'm guessing
> ISO-8859-1, else you would not have a problem.
>
Actually, I've discovered there _is_ a way of coping with both automagically,
which I'm assured is 99.99??% accurate.

I've not raised it before, 'cause you were busy on other topics. It's not
_needed_ by any current support issues that I'm aware of.

When you are ready to do work on this I've some code that you can have which may
help - via jetty-discuss?

Chris





-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Russell Neufeld
In reply to this post by Barzilai Spinak
We had the same problem as you and did the same solution - url-encoding
all links from JSPs.  To make the display of these links look better I
use the javascript function  "decodeURIComponent()", which translates
url-encoded text back to its original form.  Feels like a horrible hack
since you end up with a lot of document.write() or
document.createTextNode() calls in your page, but it makes the display
look correct for all the international people using our product.

    Russ

>So, yes, now I url-encode all the links I generate from JSP which could
>have i18n chars, like people's names and stuff like that.
>It works like a charm excepto that the poor people from non-latin
>charsets will get ugly and long urls with lots of percents!
>I guess there's not much to do about it for the time being.
>
>  
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Explorer sends UTF-8 not URLEncoded!

Greg Wilkins-5
Russell Neufeld wrote:
> We had the same problem as you and did the same solution - url-encoding
> all links from JSPs.  To make the display of these links look better I
> use the javascript function  "decodeURIComponent()", which translates
> url-encoded text back to its original form.  Feels like a horrible hack
> since you end up with a lot of document.write() or
> document.createTextNode() calls in your page, but it makes the display
> look correct for all the international people using our product.


Russ,

check out the behaviour library http://bennolan.com/behaviour/
as a cool technique to avoid cluttering up your jsp/html with
javascript.




>    Russ
>
>> So, yes, now I url-encode all the links I generate from JSP which could
>> have i18n chars, like people's names and stuff like that.
>> It works like a charm excepto that the poor people from non-latin
>> charsets will get ugly and long urls with lots of percents!
>> I guess there's not much to do about it for the time being.
>>
>>  
>>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support