URL encoding of non ASCII characters

URL encoding of non ASCII characters

am 27.08.2007 17:26:05 von hugo

Hi,

how do I have to encode non-ASCII characters like German Umlaute? I know how
to encode "normal problematic" characters like space and &. But what do I
have to do with these non-ASCII characters?

Thanks.

Re: URL encoding of non ASCII characters

am 27.08.2007 18:29:44 von jkorpela

Scripsit Hugo:

> how do I have to encode non-ASCII characters like German Umlaute? I
> know how to encode "normal problematic" characters like space and &.
> But what do I have to do with these non-ASCII characters?

Some browsers may support a URL encoding that is based on ISO-8859-1 or some
other assumed default, so that you would represent an Umlaut letter as an
octet (byte) by ISO-8859-1 and then encode the result as %xx where xx is the
code in hexadecimal.

However, the modern and official method is based on UTF-8. You first
represent an Umlaut letter as two octets by UTF-8, then encode both as %xx.

References:
http://www.apps.ietf.org/rfc/rfc3986.html#sec-2.5
http://www.w3.org/International/O-URL-and-ident.html

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/