An extremely useful and code cutting solution. Much appreciated Peter!![]()
Professional Software Development Tools
An extremely useful and code cutting solution. Much appreciated Peter!![]()
Thanks Ulrich!
I'm still around, just in a read mode with AMS of late. I still try to upload all professionally done, polish free plugins, assemblies, etc. So, if someone gets stuck, needs something. Please post it on the forums and one of us archivers will surely try to accomodate.
Intrigued
www.amsuser.com
Ulrich,
Thanks for the suggestion in the other thread about displaying Japanese Character.
Anyways, I searched and found your plugin and it seemed to be my savior.But I kept on getting this 12031 error when I attempted to use it. I double checked the unicode text file and made sure that it is saved in Unicode format. Well, it actually is just a text file with a line of Japanese char created with Notepad. So what could possibly be the cause of this error?
Thanks for your help.
Hello,
could please zip the file and attach it here? The error is expected if the encoding specified does not correspond to the actual source file, or maybe if the source file cannot be translated to the target encoding... I'll have to see what is happening.
Ulrich
Ulrich,
Here you go.
Thanks a lot.
Hi All,
this is possible to call Unicode Function or pass a string as a PWChar with memory plugin an some api programming.
i write two function (Ansi2Uni & Uni2Ansi) with these you can call unicode functions (Uses Memory Plugin 1.0.2.0)
And see example how you can call MessageBoxW(this is not possible in AMS) :Code:function Ansi2Uni(st) blen = (String.Length(st)*2)+2 wbuf = Memory.Allocate(blen) _st = Memory.Allocate(String.Length(st)) Memory.PutString(_st, st, -1, "UTF8") DLL.CallFunction("kernel32.dll", "MultiByteToWideChar", "0, 0, ".._st..", -1, "..wbuf..", "..blen, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL) Memory.Free(_st) return wbuf end function Uni2Ansi(Uni) size = DLL.CallFunction("kernel32.dll", "WideCharToMultiByte", "0, 0, "..Uni..", -1, 0, 0, 0, 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL) heap = DLL.CallFunction("kernel32.dll", "GetProcessHeap", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL) ansi = tonumber(DLL.CallFunction("kernel32.dll", "HeapAlloc", heap..", 8, "..size, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)) DLL.CallFunction("kernel32.dll", "WideCharToMultiByte", "0, 0, "..Uni..", -1, "..ansi..", "..size..", 0, 0", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL) local ret = Memory.GetString(ansi, -1, "UTF8") Memory.Free(ansi) return ret end
so i learn one thing in my Programming Life, that nothing is not impossible in programming.Code:Text = Ansi2Uni("Hello World") Caption = Ansi2Uni("Test") DLL.CallFunction("user32.dll", "MessageBoxW", Application.GetWndHandle()..", "..Text..", "..Caption..", 0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL)
Enjoy.
Last edited by AMSWaves; 08-25-2009 at 06:41 PM.
Ulrich, this really fulfils a need... I'm not sure however it can fulfil my need:
I have text in an RTF file (with Japanese characters) and I want to convert this to a UTF-8 TXT file. Or, I have copied this text from a website, and I want to save the copied japanese UTF-8 text to be save as TXT file in UTF-8.
Would this be possible with your plugin?
(I'm not sure that the clipboard plugin supports UTF-8...)
thanks for your help,
gert