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;
{
if(escape)
{
- escape=escape<<8 | (unsigned char)*i;
+ escape=escape<<8 | static_cast<unsigned char>(*i);
if(*i>='@' && *i<='Z')
{
switch(escape)
dec->flush();
}
+void Iso2022Jp::Decoder::reset()
+{
+ switch_mode(ASCII);
+ escape=0;
+}
+
void Iso2022Jp::Decoder::switch_mode(Mode m)
{
append(dec->get());