Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: url encode to utf-8

www.cryer.info
Managed Newsgroup Archive

Re: url encode to utf-8

Subject:Re: url encode to utf-8
Posted by:"Ian Stuart" (ian.stua..@chello.at)
Date:Wed, 24 May 2006 11:41:15

"ildg" <ildg@163.com> wrote in message
news:44741f9a@newsgroups.borland.com...
>
> "Piotr Szturmaj" <gacek999@NOSPAM.tlen.pl> wrote:
>>>>Utf8Encode()
>>>
>>> Thank you~
>>> But it doesn't work at all.
>>> when I pass a widestring to utf8encode, I get disordered codes.
>>
>>What do you mean by "disordered codes"? I'm using this function in my
>>applications and it works well.
>>
>>
>
> It only works on English words. If non-Enlish words are contained, the
> result will become unrecognizable, that's what I called "disordered
> codes". But in java, I can get right result, no matter what I want to
> encode.
>
> By the way, I was trying to encode Chinese words.

The results will certainly be unrecognizable if viewed as a raw string. Each
unicode character may become one, two or three characters when encoded to
UTF8. Only the characters in the range 0-127 are preserved unencoded which
will allow you to call UTF8Encode and then HttpEncode successfully. I
suspect that the inspector tool you are using in JAVA understands the string
is UTF8 and decodes it for you when you look at it. Delphi inspector does
not decode it for viewing so you what looks like garbage. Nevertheless, the
function does work.

Regards
Ian

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive