I use the HTTPEncode()
function in Delphi XE8 to encode Japanese text. Some characters can encode correctly, but some cannot. Below is an example:
aStr := HTTPEncode('萩原小学校');
I expected this:
aStr = '%E8%90%A9%E5%8E%9F%E5%B0%8F%E5%AD%A6%E6%A0%A1'
But I got this:
aStr = '%E8%90%A9%E5%8E%9F%E5%B0%8F%3F%E6%A0%A1'
Can someone help me to encode '萩原小学校'
as '%E8%90%A9%E5%8E%9F%E5%B0%8F%E5%AD%A6%E6%A0%A1'
?
'学'
character is being converted to'?'
before being encoded as%3F
. The rest of the characters are fine. Are you sure your input string is OK to begin with? Are you saving the source file as UTF-8? Is this an exact copy/paste of your real code? – Remy Lebeau?
symbols. – David HeffernanHTTPEncode()
operates onAnsiString
andTNetEncoding.URL.Encode()
operates onUnicodeString
instead – Remy LebeauHTTPEncode
was. Not least because the behaviour reported in the question seems so odd, as you describe. – David Heffernan