swiftlang / swift-foundation

The Foundation project
Apache License 2.0
2.4k stars 160 forks source link

`String.data(using:)` does not support Shift-JIS. #925

Open omochi opened 1 month ago

omochi commented 1 month ago

String.data(using:) does not support Shift-JIS as a conversion target. This was supported in the macOS version and swift-corelibs-foundation, so there is a loss of compatibility.

Shift-JIS is a Japanese character encoding, commonly used in the IT business in Japan. Due to various long-standing issues with Windows and business practices, the transition to Unicode has not progressed as much.

We are working with server-side Swift, and we rely on this conversion to Shift-JIS, which is causing us problems.

In fact, we are considering submitting a patch, but there’s a complication. String.data is defined in FoundationEssentials, not in FoundationInternationalization, so ICU cannot be used. How should we go about fixing this?