add utf8_remove_bom

This commit is contained in:
Glenn Maynard
2004-12-03 01:02:45 +00:00
parent 4e3cd6534a
commit afcacbdf85
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -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 )
+1
View File
@@ -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 );