X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fiso88591.cpp;h=17f84b1755311fde538e6b899f9823133f3d39af;hp=73169c84ef6ace9888563be239564de998ec1052;hb=f47bc86e6ce900c5323e593db003c93110538268;hpb=79d472ad3fde75de2eba2487579b047d35e56978 diff --git a/source/iso88591.cpp b/source/iso88591.cpp index 73169c8..17f84b1 100644 --- a/source/iso88591.cpp +++ b/source/iso88591.cpp @@ -10,22 +10,29 @@ Distributed under the LGPL using namespace std; namespace Msp { +namespace Codecs { -void Iso88591::Encoder::encode_char(wchar_t c_) +void Iso88591::Encoder::encode_char(UnicodeChar ch, string &buf) { - // Win32 has typedef unsigned short wchar_t - int c=c_; - if(c<0 || c>0xFF) - error("Can't express character in Latin-1"); - else - append(c); + if(ch<0 || ch>0xFF) + return error(ch, buf, "Can't express character in ISO-8859-1"); + + buf+=ch; +} + +void Iso88591::Encoder::transliterate(UnicodeChar, string &buf) +{ + buf+='?'; } -void Iso88591::Decoder::decode_char(const string &str, string::const_iterator &i) + +UnicodeChar Iso88591::Decoder::decode_char(const string &str, string::const_iterator &i) { if(i==str.end()) - return; - append(static_cast(*i++)); + return error("No input"); + + return static_cast(*i++); } +} // namespace Codecs } // namespace Msp