• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 854
  • Last Modified:

unicode characters to UTF-8(Hex)

Hi all,

I am trying to make my application compatible with international languages and I am stuck with this problem.

I'm trying to pass Unicode string as a URL  parameter but It need to be converted to HEX UTF-8 string in order to pass it.

Anyone could help me to convert unicode string to HEX UTF8?

Thank you.
0
MissManal
Asked:
MissManal
1 Solution
 
byfourCommented:
try the below code,

function urlencode(c:char):string;
begin
result:='%'+inttohex(ord(c),2);
end;

and for a complete string you can use:

function urlencodestring(const s:string):string;
var
i: integer;
begin
result:='';
for i:=1 to length(s) do
result:=result+urlencode(s[i]);
end;

and then you can use it easily like

edit2.text:=urlencodestring(edit1.text);

Open in new window


Also try using,

TEncoding.Unicode.GetString( MyByteArray );

Open in new window



Source: google
0
 
Ephraim WangoyaCommented:

This is similar to the previous question

Use UTF8Encode
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now