add utf8_remove_bom
This commit is contained in:
@@ -1031,6 +1031,14 @@ bool utf8_is_valid( const CString &s )
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Windows tends to drop garbage BOM characters at the start of UTF-8 text files.
|
||||
* Remove them. */
|
||||
void utf8_remove_bom( CString &sLine )
|
||||
{
|
||||
if( !sLine.compare(0, 3, "\xef\xbb\xbf") )
|
||||
sLine.erase(0, 3);
|
||||
}
|
||||
|
||||
const wchar_t INVALID_CHAR = 0xFFFD; /* U+FFFD REPLACEMENT CHARACTER */
|
||||
|
||||
wstring CStringToWstring( const CString &s )
|
||||
|
||||
@@ -214,6 +214,7 @@ bool utf8_to_wchar_ec( const CString &s, unsigned &start, wchar_t &ch );
|
||||
void wchar_to_utf8( wchar_t ch, CString &out );
|
||||
wchar_t utf8_get_char( const CString &s );
|
||||
bool utf8_is_valid( const CString &s );
|
||||
void utf8_remove_bom( CString &s );
|
||||
|
||||
CString WStringToCString(const wstring &str);
|
||||
CString WcharToUTF8( wchar_t c );
|
||||
|
||||
Reference in New Issue
Block a user