Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef UTF8_H
00022 #define UTF8_H
00023
00024 #include <string>
00025 #include <boost/cstdint.hpp>
00026 #include <vector>
00027
00028 #include "dsodefs.h"
00029
00030 namespace gnash {
00031
00033
00055
00059 namespace utf8 {
00060
00062
00066
00069 DSOEXPORT std::wstring decodeCanonicalString(const std::string& str, int version);
00070
00072
00082 DSOEXPORT std::string encodeCanonicalString(const std::wstring& wstr, int version);
00083
00085
00090 DSOEXPORT boost::uint32_t decodeNextUnicodeCharacter(std::string::const_iterator& it,
00091 const std::string::const_iterator& e);
00092
00095 DSOEXPORT std::string encodeUnicodeCharacter(boost::uint32_t ucs_character);
00096
00098
00101 DSOEXPORT std::string encodeLatin1Character(boost::uint32_t ucsCharacter);
00102
00103 enum TextEncoding {
00104 encUNSPECIFIED,
00105 encUTF8,
00106 encUTF16BE,
00107 encUTF16LE,
00108 encUTF32BE,
00109 encUTF32LE,
00110 encSCSU,
00111 encUTF7,
00112 encUTFEBCDIC,
00113 encBOCU1
00114 };
00115
00117
00140 DSOEXPORT char* stripBOM(char* in, size_t& size, TextEncoding& encoding);
00141
00143 DSOEXPORT const char* textEncodingName(TextEncoding enc);
00144
00145 enum EncodingGuess {
00146 ENCGUESS_UNICODE = 0,
00147 ENCGUESS_JIS = 1,
00148 ENCGUESS_OTHER = 2
00149 };
00150
00152
00153
00154
00155
00156
00159 DSOEXPORT EncodingGuess guessEncoding(const std::string& s, int& length,
00160 std::vector<int>& offsets);
00161
00162
00163 }
00164 }
00165
00166 #endif // UTF8_H
00167
00168
00169
00170
00171
00172
00173
00174