Boost.Locale
Character conversion functions

Classes

class  boost::locale::conv::conversion_error
 The exception that is thrown in case of conversion error. More...
 
class  boost::locale::conv::invalid_charset_error
 This exception is thrown in case of use of unsupported or invalid character set. More...
 

Enumerations

enum  boost::locale::conv::method_type { boost::locale::conv::skip = 0, boost::locale::conv::stop = 1, boost::locale::conv::default_method = skip }
 enum that defines conversion policy More...
 

Functions

template<typename CharType >
std::basic_string< CharType > boost::locale::conv::to_utf (const char *begin, const char *end, const std::string &charset, method_type how=default_method)
 convert text in range [begin,end) encoded with charset to UTF string according to policy how
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const CharType *begin, const CharType *end, const std::string &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::basic_string< CharType > boost::locale::conv::to_utf (const char *begin, const char *end, const std::locale &loc, method_type how=default_method)
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const CharType *begin, const CharType *end, const std::locale &loc, method_type how=default_method)
 
template<typename CharType >
std::basic_string< CharType > boost::locale::conv::to_utf (const std::string &text, const std::string &charset, method_type how=default_method)
 convert a string text encoded with charset to UTF string
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const std::basic_string< CharType > &text, const std::string &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 (const char *text, const std::string &charset, method_type how=default_method)
 Convert a text from charset to UTF string.
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const CharType *text, const std::string &charset, method_type how=default_method)
 Convert a text from UTF to charset.
 
template<typename CharType >
std::basic_string< CharType > boost::locale::conv::to_utf (const std::string &text, const std::locale &loc, method_type how=default_method)
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const std::basic_string< CharType > &text, const std::locale &loc, method_type how=default_method)
 
template<typename CharType >
std::basic_string< CharType > boost::locale::conv::to_utf (const char *text, const std::locale &loc, method_type how=default_method)
 
template<typename CharType >
std::string boost::locale::conv::from_utf (const CharType *text, const std::locale &loc, method_type how=default_method)
 
std::string boost::locale::conv::between (const char *begin, const char *end, const std::string &to_encoding, const std::string &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 (const char *text, const std::string &to_encoding, const std::string &from_encoding, method_type how=default_method)
 Convert a text to to_encoding from from_encoding.
 
std::string boost::locale::conv::between (const std::string &text, const std::string &to_encoding, const std::string &from_encoding, method_type how=default_method)
 Convert a text to to_encoding from from_encoding.
 
template<typename CharOut , typename CharIn >
std::basic_string< CharOut > boost::locale::conv::utf_to_utf (const CharIn *begin, const CharIn *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 (const CharIn *str, method_type how=default_method)
 Convert a Unicode NULL terminated string str other Unicode encoding.
 
template<typename CharOut , typename CharIn >
std::basic_string< CharOut > boost::locale::conv::utf_to_utf (const std::basic_string< CharIn > &str, method_type how=default_method)
 Convert a Unicode string str other Unicode encoding.
 

Detailed Description

Enumeration Type Documentation

◆ method_type

enum that defines conversion policy

Enumerator
skip 

Skip illegal/unconvertible characters.

stop 

Stop conversion and throw conversion_error.

default_method 

Default method - skip.

Function Documentation

◆ from_utf() [1/3]

template<typename CharType >
std::string boost::locale::conv::from_utf ( const CharType *  begin,
const CharType *  end,
const std::locale &  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

◆ from_utf() [2/3]

template<typename CharType >
std::string boost::locale::conv::from_utf ( const std::basic_string< CharType > &  text,
const std::locale &  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

◆ from_utf() [3/3]

template<typename CharType >
std::string boost::locale::conv::from_utf ( const CharType *  text,
const std::locale &  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

◆ to_utf() [1/3]

template<typename CharType >
std::basic_string<CharType> boost::locale::conv::to_utf ( const char *  begin,
const char *  end,
const std::locale &  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

◆ to_utf() [2/3]

template<typename CharType >
std::basic_string<CharType> boost::locale::conv::to_utf ( const std::string &  text,
const std::locale &  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

◆ to_utf() [3/3]

template<typename CharType >
std::basic_string<CharType> boost::locale::conv::to_utf ( const char *  text,
const std::locale &  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