1 /* 2 * Copyright 2007 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _UTF8_H 6 #define _UTF8_H 7 8 9 #include <BeBuild.h> 10 #include <InterfaceDefs.h> 11 #include <SupportDefs.h> 12 13 14 /* Conversion Flavors */ 15 enum { 16 B_ISO1_CONVERSION, /* ISO 8859-x */ 17 B_ISO2_CONVERSION, 18 B_ISO3_CONVERSION, 19 B_ISO4_CONVERSION, 20 B_ISO5_CONVERSION, 21 B_ISO6_CONVERSION, 22 B_ISO7_CONVERSION, 23 B_ISO8_CONVERSION, 24 B_ISO9_CONVERSION, 25 B_ISO10_CONVERSION, 26 B_MAC_ROMAN_CONVERSION, /* Macintosh Roman */ 27 B_SJIS_CONVERSION, /* Shift-JIS */ 28 B_EUC_CONVERSION, /* EUC Packed Japanese */ 29 B_JIS_CONVERSION, /* JIS X 0208-1990 */ 30 B_MS_WINDOWS_CONVERSION, /* Windows Latin-1 Codepage 1252 */ 31 B_UNICODE_CONVERSION, /* Unicode 2.0, UCS-2 */ 32 B_KOI8R_CONVERSION, /* KOI8-R */ 33 B_MS_WINDOWS_1251_CONVERSION, /* Windows Cyrillic Codepage 1251 */ 34 B_MS_DOS_866_CONVERSION, /* MS-DOS Codepage 866 */ 35 B_MS_DOS_CONVERSION, /* MS-DOS Codepage 437 */ 36 B_EUC_KR_CONVERSION, /* EUC Korean */ 37 B_ISO13_CONVERSION, 38 B_ISO14_CONVERSION, 39 B_ISO15_CONVERSION, 40 B_BIG5_CONVERSION, /* Chinese Big5 */ 41 B_GBK_CONVERSION, /* Chinese GB18030 */ 42 B_UTF16_CONVERSION, /* Unicode UTF-16 */ 43 B_MS_WINDOWS_1250_CONVERSION /* Windows Central European Codepage */ 44 }; 45 46 47 /* Conversion Functions */ 48 49 #ifdef __cplusplus 50 51 status_t convert_to_utf8(uint32 sourceEncoding, const char* source, 52 int32* sourceLength, char* dest, int32* destLength, int32* state, 53 char substitute = B_SUBSTITUTE); 54 55 status_t convert_from_utf8(uint32 destEncoding, const char* source, 56 int32* sourceLength, char* dest, int32* destLength, int32* state, 57 char substitute = B_SUBSTITUTE); 58 59 #endif /* __cplusplus */ 60 61 #endif /* _UTF8_H */ 62