WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: JTaylor on February 29, 2016, 07:22:41 PM

Title: Convert Unicode Hex Codes to Actual Character
Post by: JTaylor on February 29, 2016, 07:22:41 PM
Hopefully this isn't one of those DUH!!! questions...

I am trying to clean up some corruption in a library database which contains over 2,000 unique Unicode Hex Codes such as the following.   Is there a simple way to convert these to the actual character?   I started by looking up the character and doing a straight-forward replace, which works fine, but then I discovered how many unique codes there are and that approach quickly grew undesirable.

Thanks.

Jim

0x5D5;
0x5E8;
0x2BB;
0x1E33;
0x1E24;
0x1E6D;
0x101;
0x12B;
0x113;
0xE9;
0x2BC;
0xE8;
Title: Re: Convert Unicode Hex Codes to Actual Character
Post by: td on February 29, 2016, 08:11:25 PM
Take peek at ChrHexToUnicode in your handy, dandy Consolidated WIL Help file. The characters you listed aren't quite proper 4 nibble Unicode that the function expects but assuming UTF-16 you would just need to pad with zeros to get to something you can use.  Of course, you would need to remove the '0x' business and decide whether or not you are dealing with big-endian or little-endian, as well.
Title: Re: Convert Unicode Hex Codes to Actual Character
Post by: JTaylor on February 29, 2016, 09:56:09 PM
Okay.  Had tried that function but it failed saying they weren't Hex codes.   I am sure the 0x and zero padding are the issue though.  Thanks.

Jim