Passing extended chars

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I sometimes need to find a set of records via PHP/SQL with
non-English/extended characters fed to the query via a hyperlink.

For example, I have a navigation link on a site that tries to pass the
phrase "Gesundheit und Schönheit" via http with the extended character
(ö) correctly encoded as an HTML entity (ö) ;nheit

However "Gesundheit und Schönheit" is not passed to my variable, only
"Gesundheit und Sch". I reckon the ampersand is causing trouble.

If correctly encoding extend chars as html entities isn't working for
what I want, how can I encode them for storage in XHTML or otherwise get
the result I want?



Re: Passing extended chars

Quoted text here. Click to load it
Quoted text here. Click to load it

You are creating an _URL_ so if you want/need encode a tring for passing
in the _URL_ you need to _URL encode_ it:

BTW read the note under exmaple 1 of last url.

Re: Passing extended chars

Sean O'Dwyer wrote:

Quoted text here. Click to load it

(Is that an example?  If so, please follow RFC2606 and use
reserved domain names which won't conflict with current or
future ones; e.g., <http://host.invalid/ .)

URIs are made up of only a subset of US-ASCII, so after the
entity &ouml; is replaced, that isn't a URI.  You can
convert that IRI to a URI by converting 'ö' (U+00F6) to its
UTF-8 encoding and then percent-encode each octet.  Thus

I don't know what happens in the wild, but that's the
ratified way of encoding characters that are not allowed in
URIs.  See RFC3987 sec. 3.1.

Here's how the expert Martin Dürst set up his URI:

Quoted text here. Click to load it

&ouml; is simply a way to represent the character LATIN
that character is not allowed unencoded in URIs.


Site Timeline