Misc #21975
openAdd "UTF-八" as an alias for UTF-8 encoding
Description
In Japan, legal texts must write all characters - including digits - using full-width or kanji forms. As a result, the encoding name "UTF-8"
appears as "UTF-八" (八 = eight in kanji) in official government notices.
Specifically, it appears in a notice issued by the Digital Agency and the Ministry of Internal Affairs and Communications (令和8年デジタル庁・総務省告示第12号), which defines character sets and encoding for local government information systems:
地方公共団体情報システムの標準化に関する法律第七条第一項に規定する各地方公共団体情報システムに共通する基準のうち電磁的記録において用いられる用語及び符号の相互運用性の確保その他の地方公共団体情報システムに係る互換性の確保に関する標準を定める命令第三条第二号の規定に基づき行政事務標準文字の文字セット及び地方公共団体情報システム間の連携のための文字符号化方式を定める告示
This patch https://github.com/ruby/ruby/pull/16623 adds "UTF-八" as an encoding alias for UTF-8, so that Ruby is compliant with Japanese law.
# encoding: UTF-八
p __ENCODING__ #=> #<Encoding:UTF-8>
p Encoding.find("UTF-八") #=> #<Encoding:UTF-8>
p "hello".encode("UTF-八") #=> "hello"
p "こんにちは".force_encoding("UTF-八") #=> "こんにちは"
p "こんにちは".encode("U
T
F
|
八") #=> "こんにちは"