PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

How about something similar to this (did not try compiling it yet):

// parses four characters into one wchar unicode character
wchar_t ParseHex()
{
   char *digits = "0123456789ABCDEF";
   char input[4] = "9DDF";

   /* Read 4 characters of hex encoded unicode and convert them to
uppercase. */
   
if (islower(input[0]))
   input[0] = toupper(input[0]);
if (islower(input[1]))
   input[1] = toupper(input[1]);
if (islower(input[2]))
   input[2] = toupper(input[2]);
if (islower(input[3]))
   input[3] = toupper(input[3]);
      

   /* Convert from hex to wchar_t */
   return (4096 * (strchr(digits, input[0]) - strchr(digits, '0'))
        + 256 * strchr(digits, input[1]) - strchr(digits, '0'))
      + 16 * strchr(digits, input[2]) - strchr(digits, '0'))
      + strchr(digits, input[2]) - strchr(digits, '0'))

    );
}

___________________________________________________________

Does anyone know a good simple C++ algorithm for converting a hex encoded
string (such as <9DDF> ) to a wchar[]?

Rebecca

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to