encode_winansi(unsigned long codepoint)
{
    // Use this ugly switch statement to avoid a static, which is not
    // thread-safe.
    unsigned char ch = '\0';
    switch (codepoint)
    {
      case 0x20ac:
        ch = 0x80;
        break;
      case 0x201a:
        ch = 0x82;
        break;
      case 0x192:
        ch = 0x83;
        break;
      case 0x201e:
        ch = 0x84;
        break;
      case 0x2026:
        ch = 0x85;
        break;
      case 0x2020:
        ch = 0x86;
        break;
      case 0x2021:
        ch = 0x87;
        break;
      case 0x2c6:
        ch = 0x88;
        break;
      case 0x2030:
        ch = 0x89;
        break;
      case 0x160:
        ch = 0x8a;
        break;
      case 0x2039:
        ch = 0x8b;
        break;
      case 0x152:
        ch = 0x8c;
        break;
      case 0x17d:
        ch = 0x8e;
        break;
      case 0x2018:
        ch = 0x91;
        break;
      case 0x2019:
        ch = 0x92;
        break;
      case 0x201c:
        ch = 0x93;
        break;
      case 0x201d:
        ch = 0x94;
        break;
      case 0x2022:
        ch = 0x95;
        break;
      case 0x2013:
        ch = 0x96;
        break;
      case 0x2014:
        ch = 0x97;
        break;
      case 0x303:
        ch = 0x98;
        break;
      case 0x2122:
        ch = 0x99;
        break;
      case 0x161:
        ch = 0x9a;
        break;
      case 0x203a:
        ch = 0x9b;
        break;
      case 0x153:
        ch = 0x9c;
        break;
      case 0x17e:
        ch = 0x9e;
        break;
      case 0x178:
        ch = 0x9f;
        break;
      case 0xa0:
        ch = 0xa0;
        break;
      default:
        break;
    }
    return ch;
}
encode_winansi(unsigned long codepoint)
{
     
     
    unsigned char ch = '\0';
    switch (codepoint)
    {
      case 0x20ac:
        ch = 0x80;
        break;
      case 0x201a:
        ch = 0x82;
        break;
      case 0x192:
        ch = 0x83;
        break;
      case 0x201e:
        ch = 0x84;
        break;
      case 0x2026:
        ch = 0x85;
        break;
      case 0x2020:
        ch = 0x86;
        break;
      case 0x2021:
        ch = 0x87;
        break;
      case 0x2c6:
        ch = 0x88;
        break;
      case 0x2030:
        ch = 0x89;
        break;
      case 0x160:
        ch = 0x8a;
        break;
      case 0x2039:
        ch = 0x8b;
        break;
      case 0x152:
        ch = 0x8c;
        break;
      case 0x17d:
        ch = 0x8e;
        break;
      case 0x2018:
        ch = 0x91;
        break;
      case 0x2019:
        ch = 0x92;
        break;
      case 0x201c:
        ch = 0x93;
        break;
      case 0x201d:
        ch = 0x94;
        break;
      case 0x2022:
        ch = 0x95;
        break;
      case 0x2013:
        ch = 0x96;
        break;
      case 0x2014:
        ch = 0x97;
        break;
      case 0x303:
        ch = 0x98;
        break;
      case 0x2122:
        ch = 0x99;
        break;
      case 0x161:
        ch = 0x9a;
        break;
      case 0x203a:
        ch = 0x9b;
        break;
      case 0x153:
        ch = 0x9c;
        break;
      case 0x17e:
        ch = 0x9e;
        break;
      case 0x178:
        ch = 0x9f;
        break;
      case 0xa0:
        ch = 0xa0;
        break;
      default:
        break;
    }
    return ch;
}