Jump to content

Recommended Posts

Posted

Hi.

I need to send UTF-8 encoded XML. But AutoIT sends XML in ANSI because data is

in the first place ANSI.

How do I convert this XML-data (string) to UTF-8?

Posted

#Include <WinAPI.au3>

_WinAPI_WideCharToMultiByte($pUnicode[, $iCodePage = 0])

$pUnicode Pointer to a byte array structure containing Unicode text to be converted

$iCodePage Code page to use in performing the conversion:

$CP_ACP - The current system Windows ANSI code page

$CP_MACCP - The current system Macintosh code page

$CP_OEMCP - The current system OEM code page

$CP_SYMBOL - Symbol code page

$CP_THREAD_ACP - The Windows ANSI code page for the current thread

$CP_UTF7 - UTF-7

$CP_UTF8 - UTF-8

example:

send(_WinAPI_WideCharToMultiByte($mystring,$CP_UTF8))
  • 3 years later...
Posted (edited)

  On 5/14/2008 at 7:34 AM, m_havo said:

WARNING: $CP_UTF8: possibly used before declaration.

Add Global Const $CP_UTF8 = 65001 to the top of the Script.

Nice example Ramzes.

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...