Fix Iso2022Jp
authorMikko Rasa <tdb@tdb.fi>
Sun, 18 Mar 2007 16:35:35 +0000 (16:35 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 18 Mar 2007 16:35:35 +0000 (16:35 +0000)
source/iso2022jp.cpp
source/iso2022jp.h

index 6f83bd95645ae543117dee6146c5e8b6a3bcf7bc..6a6bd1dc7970b28c367fbfad07d5719c505bc0ad 100644 (file)
@@ -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;
index 89b80df0e311c8d4aae7cab953b0e0a597fc78ab..ea5209e56c19d7e4157a5632685226343507aa56 100644 (file)
@@ -20,7 +20,7 @@ public:
        public:
                Encoder(): mode(ASCII) { }
                void encode_char(wchar_t);
-               void sync() { switch_mode(ASCII); }
+               void sync();
        private:
                Mode mode;