Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 16 to 21 of 21
  1. #16
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282
    An extremely useful and code cutting solution. Much appreciated Peter!

  2. #17
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,130
    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

  3. #18
    Join Date
    Aug 2009
    Posts
    4

    What's the common cause for a 12031 error?

    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.

  4. #19
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,451
    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

  5. #20
    Join Date
    Aug 2009
    Posts
    4

    Zipped File Attached

    Ulrich,

    Here you go.

    Thanks a lot.
    Attached Files

  6. #21
    Join Date
    Jun 2008
    Location
    AMSWaves
    Posts
    231

    Lightbulb

    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)
    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
    And see example how you can call MessageBoxW(this is not possible in AMS) :
    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)
    so i learn one thing in my Programming Life, that nothing is not impossible in programming.

    Enjoy.
    Last edited by AMSWaves; 08-25-2009 at 06:41 PM.

  7. #22
    Join Date
    Nov 2004
    Location
    Belgium, Leuven
    Posts
    145
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts