From: Mikko Rasa Date: Sun, 18 Mar 2007 16:35:35 +0000 (+0000) Subject: Fix Iso2022Jp X-Git-Tag: strings-1.0~25 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5ea1720bc90416df7ac5e28b145e9ebf7f76b7a2;p=libs%2Fcore.git Fix Iso2022Jp --- diff --git a/source/iso2022jp.cpp b/source/iso2022jp.cpp index 6f83bd9..6a6bd1d 100644 --- a/source/iso2022jp.cpp +++ b/source/iso2022jp.cpp @@ -37,9 +37,18 @@ void Iso2022Jp::Encoder::encode_char(wchar_t c) throw CodecError("Can't express character in ISO-2022-JP"); if(mode!=JISX0208) switch_mode(JISX0208); + + char buf[2]={jis>>8, jis}; + append(buf, 2); } } +void Iso2022Jp::Encoder::sync() +{ + if(mode!=ASCII) + switch_mode(ASCII); +} + void Iso2022Jp::Encoder::switch_mode(Mode m) { mode=m; diff --git a/source/iso2022jp.h b/source/iso2022jp.h index 89b80df..ea5209e 100644 --- a/source/iso2022jp.h +++ b/source/iso2022jp.h @@ -20,7 +20,7 @@ public: public: Encoder(): mode(ASCII) { } void encode_char(wchar_t); - void sync() { switch_mode(ASCII); } + void sync(); private: Mode mode;