Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EUC-JIS-2004 (JIS X 0213) を使っている辞書を読み込めない #77

Closed
mtgto opened this issue Dec 31, 2023 · 1 comment · Fixed by #82
Closed

EUC-JIS-2004 (JIS X 0213) を使っている辞書を読み込めない #77

mtgto opened this issue Dec 31, 2023 · 1 comment · Fixed by #82

Comments

@mtgto
Copy link
Owner

mtgto commented Dec 31, 2023

https://skk-dev.github.io/dict/ にある SKK-JISYO.fullname には、次のような行があります。

かわさききよつぐ /川﨑清嗣;<JISX0213>フルネーム,精神科医/

https://github.com/skk-dev/dict/blob/master/SKK-JISYO.fullname

通常のブラウザでは"﨑"の字が文字化けしているかもしれません。

これはどうもEUC-JPの拡張で、JIS X 0213の範囲まで広げたもののようです。
https://x0213.org/wiki/wiki.cgi?page=EUC%2DJIS%2D2004

macOSのEUC-JPはこの範囲に対応してないらしく、例えばmacOSのテキストエディタやCotEditorなどでもEUCを指定してもSKK-JISYO.fullnameは開けません。
同じ理由でmacSKKでもEUC-JPでファイルを開こうとするところでエラーが発生し読み込みに失敗します。

image

AquaSKKではこのような文字でも読み込めるように独自で実装しているようです。
https://github.com/codefirst/aquaskk/blob/4.7.5/src/engine/utility/jconv.cpp

ワークアラウンド

ひとまず暫定対応としては、UTF-8に変換したものを使ってください。
iconvを使ってEUC-JISX0213をUTF-8に変換できます。(macOS 14.2.1で確認)

iconv -t UTF-8 -f EUC-JISX0213 < SKK-JISYO.fullname > SKK-JISYO.fullname.utf8

ちゃんとEUC-JP-2004形式の読み込みに対応してもいいですが、優先度は今のところあまり高くありません。

@mtgto
Copy link
Owner Author

mtgto commented Dec 31, 2023

iconvがEUC-JIS-2004に対応しているのであればlibiconvを使って生データから変換するのが楽かなあ。
https://www.man7.org/linux/man-pages/man3/iconv.3.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant