From: Glenn M. <gma...@us...> - 2003-06-30 08:39:20
|
Update of /cvsroot/stepmania/stepmania/src In directory sc8-pr-cvs1:/tmp/cvs-serv17921 Modified Files: RageUtil_CharConversions.cpp Log Message: add iso-8859-1 separate utf-8 Index: RageUtil_CharConversions.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/RageUtil_CharConversions.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- RageUtil_CharConversions.cpp 21 May 2003 00:06:03 -0000 1.1 +++ RageUtil_CharConversions.cpp 30 Jun 2003 08:39:18 -0000 1.2 @@ -29,6 +29,7 @@ return true; } +static bool AttemptEnglishConversion( CString &txt ) { return CodePageConvert( txt, 1252 ); } static bool AttemptKoreanConversion( CString &txt ) { return CodePageConvert( txt, 949 ); } static bool AttemptJapaneseConversion( CString &txt ) { return CodePageConvert( txt, 932 ); } @@ -40,6 +41,7 @@ #else /* No converters are available, so all fail--we only accept UTF-8. */ +static bool AttemptEnglishConversion( CString &txt ) { return false; } static bool AttemptKoreanConversion( CString &txt ) { return false; } static bool AttemptJapaneseConversion( CString &txt ) { return false; } @@ -50,12 +52,22 @@ CStringArray lst; split(encodings, ",", lst); - /* Is the string already valid utf-8? */ - if( utf8_is_valid(str) ) - return true; - for(unsigned i = 0; i < lst.size(); ++i) { + if( lst[i] == "utf-8" ) + { + /* Is the string already valid utf-8? */ + if( utf8_is_valid(str) ) + return true; + continue; + } + if( lst[i] == "english" ) + { + if(AttemptEnglishConversion(str)) + return true; + continue; + } + if( lst[i] == "japanese" ) { if(AttemptJapaneseConversion(str)) @@ -70,7 +82,7 @@ continue; } - RageException::Throw( "Unexpected conversion string \"%s\" (string \"%s\"", + RageException::Throw( "Unexpected conversion string \"%s\" (string \"%s\")", lst[i].c_str(), str.c_str() ); } |