Skip to content

Commit

Permalink
bytes_to_str() Win32: sync with EncodingList in KSC
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Aug 30, 2024
1 parent 07ff9cf commit d85cee9
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions kaitai/kaitaistream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,22 +876,10 @@ int kaitai::kstream::encoding_to_win_codepage(const char *src_enc) {
std::string enc(src_enc);
if (enc == "UTF-8") {
return CP_UTF8;
} else if (enc == "UTF-16LE") {
return KAITAI_CP_UTF16LE;
} else if (enc == "UTF-16BE") {
return KAITAI_CP_UTF16BE;
} else if (enc == "IBM437") {
return 437;
} else if (enc == "IBM850") {
return 850;
} else if (enc == "SHIFT_JIS") {
return 932;
} else if (enc == "GB2312") {
return 936;
} else if (enc == "ASCII") {
return 20127;
} else if (enc == "EUC-JP") {
return 20932;
} else if (enc == "UTF-16LE") {
return KAITAI_CP_UTF16LE;
} else if (enc == "ISO-8859-1") {
return 28591;
} else if (enc == "ISO-8859-2") {
Expand Down Expand Up @@ -934,6 +922,24 @@ int kaitai::kstream::encoding_to_win_codepage(const char *src_enc) {
// > The Windows code page number for this encoding is 28606, but kernel32.dll
// > does not support this encoding.
return KAITAI_CP_UNSUPPORTED;
} else if (enc == "IBM437") {
return 437;
} else if (enc == "IBM850") {
return 850;
} else if (enc == "IBM866") {
return 866;
} else if (enc == "Shift_JIS") {
return 932;
} else if (enc == "GB2312") {
return 936;
} else if (enc == "Big5") {
return 950;
} else if (enc == "ASCII") {
return 20127;
} else if (enc == "EUC-JP") {
return 20932;
} else if (enc == "EUC-KR") {
return 51949;
}

return KAITAI_CP_UNSUPPORTED;
Expand Down

0 comments on commit d85cee9

Please sign in to comment.