Home | History | Annotate | Download | only in crt
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef XFA_FGAS_CRT_FGAS_CODEPAGE_H_
      8 #define XFA_FGAS_CRT_FGAS_CODEPAGE_H_
      9 
     10 #include "core/fxcrt/fx_basic.h"
     11 
     12 #define FX_CODEPAGE_DefANSI 0
     13 #define FX_CODEPAGE_DefOEM 1
     14 #define FX_CODEPAGE_DefMAC 2
     15 #define FX_CODEPAGE_Thread 3
     16 #define FX_CODEPAGE_Symbol 42
     17 #define FX_CODEPAGE_MSDOS_US 437
     18 #define FX_CODEPAGE_Arabic_ASMO708 708
     19 #define FX_CODEPAGE_Arabic_ASMO449Plus 709
     20 #define FX_CODEPAGE_Arabic_Transparent 710
     21 #define FX_CODEPAGE_Arabic_NafithaEnhanced 711
     22 #define FX_CODEPAGE_Arabic_TransparentASMO 720
     23 #define FX_CODEPAGE_MSDOS_Greek1 737
     24 #define FX_CODEPAGE_MSDOS_Baltic 775
     25 #define FX_CODEPAGE_MSWin31_WesternEuropean 819
     26 #define FX_CODEPAGE_MSDOS_WesternEuropean 850
     27 #define FX_CODEPAGE_MSDOS_EasternEuropean 852
     28 #define FX_CODEPAGE_MSDOS_Latin3 853
     29 #define FX_CODEPAGE_MSDOS_Cyrillic 855
     30 #define FX_CODEPAGE_MSDOS_Turkish 857
     31 #define FX_CODEPAGE_MSDOS_Latin1Euro 858
     32 #define FX_CODEPAGE_MSDOS_Portuguese 860
     33 #define FX_CODEPAGE_MSDOS_Icelandic 861
     34 #define FX_CODEPAGE_MSDOS_Hebrew 862
     35 #define FX_CODEPAGE_MSDOS_FrenchCanadian 863
     36 #define FX_CODEPAGE_MSDOS_Arabic 864
     37 #define FX_CODEPAGE_MSDOS_Norwegian 865
     38 #define FX_CODEPAGE_MSDOS_Russian 866
     39 #define FX_CODEPAGE_MSDOS_Greek2 869
     40 #define FX_CODEPAGE_MSDOS_Thai 874
     41 #define FX_CODEPAGE_MSDOS_KamenickyCS 895
     42 #define FX_CODEPAGE_ShiftJIS 932
     43 #define FX_CODEPAGE_ChineseSimplified 936
     44 #define FX_CODEPAGE_Korean 949
     45 #define FX_CODEPAGE_ChineseTraditional 950
     46 #define FX_CODEPAGE_UTF16LE 1200
     47 #define FX_CODEPAGE_UTF16BE 1201
     48 #define FX_CODEPAGE_MSWin_EasternEuropean 1250
     49 #define FX_CODEPAGE_MSWin_Cyrillic 1251
     50 #define FX_CODEPAGE_MSWin_WesternEuropean 1252
     51 #define FX_CODEPAGE_MSWin_Greek 1253
     52 #define FX_CODEPAGE_MSWin_Turkish 1254
     53 #define FX_CODEPAGE_MSWin_Hebrew 1255
     54 #define FX_CODEPAGE_MSWin_Arabic 1256
     55 #define FX_CODEPAGE_MSWin_Baltic 1257
     56 #define FX_CODEPAGE_MSWin_Vietnamese 1258
     57 #define FX_CODEPAGE_Johab 1361
     58 #define FX_CODEPAGE_MAC_Roman 10000
     59 #define FX_CODEPAGE_MAC_ShiftJIS 10001
     60 #define FX_CODEPAGE_MAC_ChineseTraditional 10002
     61 #define FX_CODEPAGE_MAC_Korean 10003
     62 #define FX_CODEPAGE_MAC_Arabic 10004
     63 #define FX_CODEPAGE_MAC_Hebrew 10005
     64 #define FX_CODEPAGE_MAC_Greek 10006
     65 #define FX_CODEPAGE_MAC_Cyrillic 10007
     66 #define FX_CODEPAGE_MAC_ChineseSimplified 10008
     67 #define FX_CODEPAGE_MAC_Thai 10021
     68 #define FX_CODEPAGE_MAC_EasternEuropean 10029
     69 #define FX_CODEPAGE_MAC_Turkish 10081
     70 #define FX_CODEPAGE_UTF32LE 12000
     71 #define FX_CODEPAGE_UTF32BE 12001
     72 #define FX_CODEPAGE_ISO8859_1 28591
     73 #define FX_CODEPAGE_ISO8859_2 28592
     74 #define FX_CODEPAGE_ISO8859_3 28593
     75 #define FX_CODEPAGE_ISO8859_4 28594
     76 #define FX_CODEPAGE_ISO8859_5 28595
     77 #define FX_CODEPAGE_ISO8859_6 28596
     78 #define FX_CODEPAGE_ISO8859_7 28597
     79 #define FX_CODEPAGE_ISO8859_8 28598
     80 #define FX_CODEPAGE_ISO8859_9 28599
     81 #define FX_CODEPAGE_ISO8859_10 28600
     82 #define FX_CODEPAGE_ISO8859_11 28601
     83 #define FX_CODEPAGE_ISO8859_12 28602
     84 #define FX_CODEPAGE_ISO8859_13 28603
     85 #define FX_CODEPAGE_ISO8859_14 28604
     86 #define FX_CODEPAGE_ISO8859_15 28605
     87 #define FX_CODEPAGE_ISO8859_16 28606
     88 #define FX_CODEPAGE_ISCII_Devanagari 57002
     89 #define FX_CODEPAGE_ISCII_Bengali 57003
     90 #define FX_CODEPAGE_ISCII_Tamil 57004
     91 #define FX_CODEPAGE_ISCII_Telugu 57005
     92 #define FX_CODEPAGE_ISCII_Assamese 57006
     93 #define FX_CODEPAGE_ISCII_Oriya 57007
     94 #define FX_CODEPAGE_ISCII_Kannada 57008
     95 #define FX_CODEPAGE_ISCII_Malayalam 57009
     96 #define FX_CODEPAGE_ISCII_Gujarati 57010
     97 #define FX_CODEPAGE_ISCII_Punjabi 57011
     98 #define FX_CODEPAGE_UTF7 65000
     99 #define FX_CODEPAGE_UTF8 65001
    100 #define FX_CHARSET_ANSI 0
    101 #define FX_CHARSET_Default 1
    102 #define FX_CHARSET_Symbol 2
    103 #define FX_CHARSET_MAC_Roman 77
    104 #define FX_CHARSET_MAC_ShiftJIS 78
    105 #define FX_CHARSET_MAC_Korean 79
    106 #define FX_CHARSET_MAC_ChineseSimplified 80
    107 #define FX_CHARSET_MAC_ChineseTriditional 81
    108 #define FX_CHARSET_MAC_Johab 82
    109 #define FX_CHARSET_MAC_Hebrew 83
    110 #define FX_CHARSET_MAC_Arabic 84
    111 #define FX_CHARSET_MAC_Greek 85
    112 #define FX_CHARSET_MAC_Turkish 86
    113 #define FX_CHARSET_MAC_Thai 87
    114 #define FX_CHARSET_MAC_EasternEuropean 88
    115 #define FX_CHARSET_MAC_Cyrillic 89
    116 #define FX_CHARSET_ShiftJIS 128
    117 #define FX_CHARSET_Korean 129
    118 #define FX_CHARSET_Johab 130
    119 #define FX_CHARSET_ChineseSimplified 134
    120 #define FX_CHARSET_ChineseTriditional 136
    121 #define FX_CHARSET_MSWin_Greek 161
    122 #define FX_CHARSET_MSWin_Turkish 162
    123 #define FX_CHARSET_MSWin_Vietnamese 163
    124 #define FX_CHARSET_MSWin_Hebrew 177
    125 #define FX_CHARSET_MSWin_Arabic 178
    126 #define FX_CHARSET_ArabicTraditional 179
    127 #define FX_CHARSET_ArabicUser 180
    128 #define FX_CHARSET_HebrewUser 181
    129 #define FX_CHARSET_MSWin_Baltic 186
    130 #define FX_CHARSET_MSWin_Cyrillic 204
    131 #define FX_CHARSET_Thai 222
    132 #define FX_CHARSET_MSWin_EasterEuropean 238
    133 #define FX_CHARSET_US 254
    134 #define FX_CHARSET_OEM 255
    135 
    136 uint16_t FX_GetCodePageFromCharset(uint8_t charset);
    137 uint16_t FX_GetCodePageFromStringW(const FX_WCHAR* pStr, int32_t iLength);
    138 uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage);
    139 void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength);
    140 
    141 void FX_UTF16ToWChar(void* pBuffer, int32_t iLength);
    142 int32_t FX_DecodeString(uint16_t wCodePage,
    143                         const FX_CHAR* pSrc,
    144                         int32_t* pSrcLen,
    145                         FX_WCHAR* pDst,
    146                         int32_t* pDstLen,
    147                         bool bErrBreak);
    148 int32_t FX_UTF8Decode(const FX_CHAR* pSrc,
    149                       int32_t* pSrcLen,
    150                       FX_WCHAR* pDst,
    151                       int32_t* pDstLen);
    152 
    153 #endif  // XFA_FGAS_CRT_FGAS_CODEPAGE_H_
    154