boost::locale::conv:: 字符編碼轉換

相關字符集轉換函數功能摘要:

std::string boost::locale::conv::between ( char const * begin,

char const * end,

std::string const & to_encoding,

std::string const & from_encoding,

method_type how = default_method

)

Convert a text in range [begin,end) to to_encoding from from_encoding

std::string boost::locale::conv::between ( char const * text,

std::string const & to_encoding,

std::string const & from_encoding,

method_type how = default_method

) [inline]

Convert a text to to_encoding from from_encoding

std::string boost::locale::conv::between ( std::string const & text,

std::string const & to_encoding,

std::string const & from_encoding,

method_type how = default_method

) [inline]

Convert a text to to_encoding from from_encoding

template<typename CharType >

std::string boost::locale::conv::from_utf ( CharType const * begin,

CharType const * end,

std::string const & charset,

method_type how = default_method

)

convert UTF text in range [begin,end) to a text encoded with charset according to policy how

template<typename CharType >

std::string boost::locale::conv::from_utf ( CharType const * begin,

CharType const * end,

std::locale const & loc,

method_type how = default_method

)

convert UTF text in range [begin,end) to a text encoded according to locale loc according to policy how

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharType >

std::string boost::locale::conv::from_utf ( std::basic_string< CharType > const & text,

std::string const & charset,

method_type how = default_method

)

Convert a text from charset to UTF string

template<typename CharType >

std::string boost::locale::conv::from_utf ( CharType const * text,

std::string const & charset,

method_type how = default_method

)

Convert a text from UTF to charset

template<typename CharType >

std::string boost::locale::conv::from_utf ( std::basic_string< CharType > const & text,

std::locale const & loc,

method_type how = default_method

)

Convert a text in UTF to locale encoding given by loc

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharType >

std::string boost::locale::conv::from_utf ( CharType const * text,

std::locale const & loc,

method_type how = default_method

)

Convert a text in UTF to locale encoding given by loc

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( char const * begin,

char const * end,

std::string const & charset,

method_type how = default_method

)

convert string to UTF string from text in range [begin,end) encoded with charset according to policy how

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( char const * begin,

char const * end,

std::locale const & loc,

method_type how = default_method

)

convert string to UTF string from text in range [begin,end) encoded according to locale loc according to policy how

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( std::string const & text,

std::string const & charset,

method_type how = default_method

)

convert a string text encoded with charset to UTF string

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( char const * text,

std::string const & charset,

method_type how = default_method

)

Convert a text from charset to UTF string

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( std::string const & text,

std::locale const & loc,

method_type how = default_method

)

Convert a text in locale encoding given by loc to UTF

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharType >

std::basic_string<CharType> boost::locale::conv::to_utf ( char const * text,

std::locale const & loc,

method_type how = default_method

)

Convert a text in locale encoding given by loc to UTF

Note:

throws std::bad_cast if the loc does not have info facet installed

template<typename CharOut , typename CharIn >

std::basic_string<CharOut> boost::locale::conv::utf_to_utf ( CharIn const * begin,

CharIn const * end,

method_type how = default_method

)

Convert a Unicode text in range [begin,end) to other Unicode encoding

template<typename CharOut , typename CharIn >

std::basic_string<CharOut> boost::locale::conv::utf_to_utf ( CharIn const * str,

method_type how = default_method

)

Convert a Unicode NUL terminated string str other Unicode encoding

template<typename CharOut , typename CharIn >

std::basic_string<CharOut> boost::locale::conv::utf_to_utf ( std::basic_string< CharIn > const & str,

method_type how = default_method

)

Convert a Unicode string str other Unicode encoding

 

 

舉例子:

 string str1 = "中國,我愛你";

std::string output= boost::locale::conv::between(

str1, "GB2312", "UTF-8");

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章