如何在 Mac OS X 终端中显示日语字符?
因此,我正在运行 MeCab (http://mecab.sourceforge.net/#download) 进行分词并对日语句子进行形态分析。但是,当我运行该程序时,由于 Mac OS X 终端中的一些编码问题,我看到了 abracadabra。我用谷歌搜索了这个主题,添加了 Dfile.encoding 选项,在 .inputrc 中添加了以下 3 行:
set convert-meta off
set meta-flag on
set output-meta on
没有任何效果。关于如何在 Mac OS X 终端中显示日语字符有什么想法吗?这是程序 test.java 运行的输出:
env DYLD_LIBRARY_PATH=. /usr/bin/java -Dfile.encoding=utf-8 test
0.98pre3
å¤ ̾»ì,°ìÈÌ,*,*,*,*,*
ª郎ã µ¹æ,°ìÈÌ,*,*,*,*,*
¯ä ̾»ì,¸Çͭ̾»ì,Áȿ¥,*,*,*,*
º郎にこのæ µ¹æ,°ìÈÌ,*,*,*,*,*
¬ã ̾»ì,¥µÊÑÀܳ,*,*,*,*,*
µ¹æ,°ìÈÌ,*,*,*,*,*
æ¸ ̾»ì,°ìÈÌ,*,*,*,*,*
¡ã µ¹æ,³ç
BOS/EOS,*,*,*,*,*,*,*,*
å ̾»ì,°ìÈÌ,*,*,*,*
ª郎 µ¹æ,°ìÈÌ,*,*,*
¯ ̾»ì,¸Çͭ̾»ì,Áȿ¥,*,*
º郎にこ µ¹æ,°ìÈÌ,*,*,*
¬ ̾»ì,¥µÊÑÀܳ,*,*,*,
µ¹æ,°ìÈÌ,*,*,*
æ ̾»ì,°ìÈÌ,*,*,*,*
¡ µ¹æ,³ç¸̳«,*,*,*,*
µ¹æ,°ìÈÌ,*,*,*
BOS/EOS,*,*,*,*,*,*,*,*
EOS
So I'm running MeCab (http://mecab.sourceforge.net/#download) to word-segment and do morpho-analysis of Japanese sentences. However, when I run the program, I see abracadabra due to some encoding issues in Mac OS X Terminal. I googled the topic, added Dfile.encoding option, added the following 3 lines in .inputrc:
set convert-meta off
set meta-flag on
set output-meta on
Nothing works. Any ideas how to show Japanese characters in Mac OS X Terminal? Here's the output of the run of the program test.java:
env DYLD_LIBRARY_PATH=. /usr/bin/java -Dfile.encoding=utf-8 test
0.98pre3
å¤ ̾»ì,°ìÈÌ,*,*,*,*,*
ª郎ã µ¹æ,°ìÈÌ,*,*,*,*,*
¯ä ̾»ì,¸Çͭ̾»ì,Áȿ¥,*,*,*,*
º郎にこのæ µ¹æ,°ìÈÌ,*,*,*,*,*
¬ã ̾»ì,¥µÊÑÀܳ,*,*,*,*,*
µ¹æ,°ìÈÌ,*,*,*,*,*
æ¸ ̾»ì,°ìÈÌ,*,*,*,*,*
¡ã µ¹æ,³ç
BOS/EOS,*,*,*,*,*,*,*,*
å ̾»ì,°ìÈÌ,*,*,*,*
ª郎 µ¹æ,°ìÈÌ,*,*,*
¯ ̾»ì,¸Çͭ̾»ì,Áȿ¥,*,*
º郎にこ µ¹æ,°ìÈÌ,*,*,*
¬ ̾»ì,¥µÊÑÀܳ,*,*,*,
µ¹æ,°ìÈÌ,*,*,*
æ ̾»ì,°ìÈÌ,*,*,*,*
¡ µ¹æ,³ç¸̳«,*,*,*,*
µ¹æ,°ìÈÌ,*,*,*
BOS/EOS,*,*,*,*,*,*,*,*
EOS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我本以为这是默认设置,但您可以尝试从首选项...、设置中选择“Unicode (UTF-8)”作为字符编码, 高级、国际。如果已设置,您可能需要确认您的程序输出实际上是用 UTF-8 编码的。可能是 Shift-JIS、EUC,甚至是 UTF-16?在这种情况下,请尝试从首选项...、编码启用这些编码。
I would have thought that this was the default setting, but you could try selecting "Unicode (UTF-8)" as the Character encoding from Preferences..., Settings, Advanced, International. If this is already set, you may want to confirm that your program output is actually encoded in UTF-8. It could be Shift-JIS, EUC, or even UTF-16? In that case, try enabling those encodings from Preferences..., Encodings.
之后
“mecab -D”的输出是
这是运行测试程序的输出。
为了使编码工作我缺少什么?
P/S:所有日语编码均在“偏好设置”-“终端编码”中启用,Mac OS X 终端中的编码(“偏好设置”-“设置”-“高级”-“国际”)是 UTF-8。
After this
the output of 'mecab -D' is
Here's the output of running the test program.
What am I missing to make encoding work?
P/S: all Japanese encodings are enabled at Preferences - Encodings in Terminal, encoding (Preferences - Settings - Advanced - International) in Mac OS X Terminal is UTF-8.