X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fcodec.cpp;h=21ddf8a7307ff8071551f4eb0473dfff48f05898;hp=d1fc1dfb0730adbfc94e5c2c7d50335172596cf8;hb=817e584903996a041692640720a5a272d847a3c7;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848 diff --git a/source/stringcodec/codec.cpp b/source/stringcodec/codec.cpp index d1fc1df..21ddf8a 100644 --- a/source/stringcodec/codec.cpp +++ b/source/stringcodec/codec.cpp @@ -6,6 +6,7 @@ #include "iso885915.h" #include "jisx0201.h" #include "jisx0208.h" +#include "utf16.h" #include "utf8.h" #include "windows1252.h" @@ -74,7 +75,7 @@ Codec *create_codec(const string &n) name += *i; } - ErrorMode em = THROW_ON_ERROR; + ErrorMode em = DEFAULT; if(i!=n.end() && *i==':') { string em_str(i+1, n.end()); @@ -96,6 +97,9 @@ Codec *create_codec(const string &n) if(name=="jisx0201") return new JisX0201(em); if(name=="jisx0208") return new JisX0208(em); if(name=="utf8") return new Utf8(em); + if(name=="utf16") return new Utf16(em, Utf16::AUTO); + if(name=="utf16be") return new Utf16(em, Utf16::BIG); + if(name=="utf16le") return new Utf16(em, Utf16::LITTLE); if(name=="windows1252" || name=="cp1252") return new Windows1252(em); throw invalid_argument("unknown string codec"); }