* @brief Returns the `QTextCodec` for multi-byte East-Asian encodings. */
| 908 | * @brief Returns the `QTextCodec` for multi-byte East-Asian encodings. |
| 909 | */ |
| 910 | static QTextCodec* legacyCodec(SerialStudio::TextEncoding enc) |
| 911 | { |
| 912 | const char* name = nullptr; |
| 913 | switch (enc) { |
| 914 | case SerialStudio::EncGbk: |
| 915 | name = "GBK"; |
| 916 | break; |
| 917 | case SerialStudio::EncGb18030: |
| 918 | name = "GB18030"; |
| 919 | break; |
| 920 | case SerialStudio::EncBig5: |
| 921 | name = "Big5"; |
| 922 | break; |
| 923 | case SerialStudio::EncShiftJis: |
| 924 | name = "Shift_JIS"; |
| 925 | break; |
| 926 | case SerialStudio::EncEucJp: |
| 927 | name = "EUC-JP"; |
| 928 | break; |
| 929 | case SerialStudio::EncEucKr: |
| 930 | name = "EUC-KR"; |
| 931 | break; |
| 932 | default: |
| 933 | break; |
| 934 | } |
| 935 | |
| 936 | QTextCodec* codec = name ? QTextCodec::codecForName(name) : nullptr; |
| 937 | if (!codec) |
| 938 | codec = QTextCodec::codecForName("UTF-8"); |
| 939 | |
| 940 | Q_ASSERT(codec != nullptr); |
| 941 | return codec; |
| 942 | } |
| 943 | |
| 944 | /** |
| 945 | * @brief Returns the display labels for all supported text encodings. |
no outgoing calls
no test coverage detected