nikhil1511 opened a new issue, #1514:
URL: https://github.com/apache/poi/issues/1514

   ### Description
   
   `CodePageUtil.codepageToEncoding` maps Windows code pages `932` (`CP_SJIS`) 
and `950` to non-Microsoft character tables in OpenJDK:
   
   1. **Code page 932 (Japanese, `LocaleID.JA_JP`)**: `case CP_SJIS:` returns 
`"SJIS"`, which resolves to `Shift_JIS` (strict JIS X 0208) rather than IANA 
`Windows-31J` (`windows-31j` / `MS932`). Windows code page 932 includes NEC 
special characters (row 13, such as `①` at `0x8740` and `㈱`) and NEC-selected 
IBM extensions (rows 89–92, such as `髙` at `0xFBFC`), and maps several symbols 
(such as `~` `0x8160` -> `U+FF5E`) differently from strict `Shift_JIS`. Note 
that Mac Japanese (`CP_MAC_JAPAN = 10001`) has its own separate `case 
CP_MAC_JAPAN:` returning `"SJIS"`.
   2. **Code page 950 (Traditional Chinese, `LocaleID.ZH_TW` / 
`LocaleID.ZH_HK`)**: has no explicit `case`, so `default:` returns `"cp950"`. 
In OpenJDK, `"cp950"` is an alias for `x-IBM950` (IBM's Big5 variant) rather 
than Microsoft's code page 950 (`x-windows-950` / `MS950`), leaving Microsoft 
Big5 characters such as `╭` (`0xA27E`), `€` (`0xA3E1`), and `裏` unmapped or 
mapped differently.
   
   By contrast, `CodePageUtil` already maps the other two Windows East Asian 
DBCS code pages to their Microsoft variants (`CP_GBK = 936` -> `"GBK"` and 
`CP_MS949 = 949` -> `"ms949"`), and HWPF's `DoubleByteUtil` / 
`LittleEndianCP950Reader` likewise documents code page 950 as Microsoft's Big5 
dialect.
   
   ### Expected behavior
   
   - `CodePageUtil.codepageToEncoding(932, javaLangFormat)` returns `"MS932"` 
when `javaLangFormat` is `true` and `"windows-31j"` when `false`.
   - `CodePageUtil.codepageToEncoding(950, javaLangFormat)` returns `"MS950"` 
when `javaLangFormat` is `true` and `"x-windows-950"` when `false`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to