[Expat-discuss] Accented Characters

Régis St-Gelais (Laubrass) regis.st-gelais at laubrass.com
Mon Jan 10 19:13:14 CET 2005


----- Original Message ----- 
From: Bruce Warmer
To: expat-discuss at libexpat.org
Sent: Monday, January 10, 2005 12:15 PM
Subject: [Expat-discuss] Accented Characters
>
>
>Hi,
>
>I am having a little trouble getting Expat to process encoded characters 
>such as "Ä" (Ä) in character data.  Instead of being passed through as 
>they are, or appearing as the character, such encodings come across as 
>strange representations such as "ü".
>
>Please can somebody point me in the right direction.
>
Expat gives you the data in UTF-8

Here is a piece of code I use to convert it to ASCII:

void UTF8_to_ASCII(char *strpText)
 {
 int intA,intU;
    int intChar;

    intA=0;
    intU=0;


    while (strpText[intU]!=0)
     {
        intChar=(unsigned char)strpText[intU];
  switch (intChar)
         {
         case 0xc2:
                strpText[intA]=strpText[intU+1];
             intA++;
             intU+=2;
                break;

         case 0xc3:
                strpText[intA]=strpText[intU+1]+64;
             intA++;
             intU+=2;
                break;

            default:
             strpText[intA]=strpText[intU];
             intA++;
             intU++;
             break;
            }
  }
    strpText[intA]=0;
    }


Regis St-Gelais
www.laubrass.com




More information about the Expat-discuss mailing list