Announcement
Collapse
No announcement yet.
Ansi to Unicode DLL
Collapse
X
-
Originally posted by Shrek View PostWhat is it your doing with Unicode strings? I ask as there is a couple of plugins that are supported that deal with Unicode should you not get this DLL.
Comment
-
-
-
Simple answer:
Code:String.AnsiToUnicode = function(s) local res = nil; local len = s:len(); local new = (len * 2) + 2; local buf = MemoryEx.AllocateEx(new); if(buf)then buf:String(len, MEMEX_UNICODE, s); res = buf:LString(new); buf:Free(); end return res; end;
Code:Debug.ShowWindow(); local test = String.AnsiToUnicode("Hello World!!"); for i = 1, test:len() do local charCode = test:byte(i); Debug.Print(charCode.."\r\n"); end
Comment
-
-
Originally posted by Imagine Programming View PostSimple answer:
Code:String.AnsiToUnicode = function(s) local res = nil; local len = s:len(); local new = (len * 2) + 2; local buf = MemoryEx.AllocateEx(new); if(buf)then buf:String(len, MEMEX_UNICODE, s); res = buf:LString(new); buf:Free(); end return res; end;
Code:Debug.ShowWindow(); local test = String.AnsiToUnicode("Hello World!!"); for i = 1, test:len() do local charCode = test:byte(i); Debug.Print(charCode.."\r\n"); end
I want to convert ANSI to Unicode for use in HTTP.Submit function to sent it to a php file.
But your example convert ANSI to strings like Number. I can't use this, I don't need Unicode number.
Can I Convert My String to a Readable Unicode or UTF-8?
My string contain Arabic or Persian Characters.
Comment
-
-
If you actually look at the code, you'll see that the representation of the result is only an example. The function converts ANSI data to Unicode data in a Lua string (which supports null characters). HTTP.Submit or any other AMS function usually do not support unicode data, so you'll need something else (WinAPI).
If you don't understand this small piece of code, I'm not sure how to help you further.
Comment
-
Comment