Dear Will,

Making the assumption for the moment that your platform's wchar_t is
already Unicode, the first problem is that it almost certainly is either
UTF-16 or UTF-32. As a result, the "hex representation" will be of that
encoding and not of your locale's encoding (UTF-8 in this case).

If you want to see the locale encoding, you will need to call
wctombs() and then iterate across the char* you get back from that.

Best Regards,

Addison

===============================================================
Addison P. Phillips                     Globalization Architect
webMethods, Inc                       http://www.webmethods.com
Sunnyvale, CA, USA              mailto:[EMAIL PROTECTED]

+1 408.210.3569 (mobile)                  +1 408.962.5487 (ofc)
===============================================================
"Internationalization is not a feature. It is an architecture."

On Wed, 31 Oct 2001, Tay, William wrote:

> Hi,
>  
> For debugging purpose, I'd like to find out how I can print the byte
> representation of a wchar_t string. 
>  
> Say in C, I have wchar_t wstr[10] = L"fran";
> Is there any printf or wchar equivalent function (using appropriate format
> template) that prints out the string as 
> 66 72 C3 A1 6E in en_US.UTF-8 locale under UNIX?
> 
> Like for an ASCII char, I can do printf("%x", toasii('a')); to get 61 (the
> byte rep of 'a');
>  
> Would appreciate your help.
> 
> Will
> 
> 


Reply via email to