gpt4 book ai didi

Ruby 显示 unicode 字符

转载 作者:数据小太阳 更新时间:2023-10-29 08:32:49 24 4
gpt4 key购买 nike

我正在尝试打印出一些 Unicode 字符:

# encoding: utf-8
puts "ử ậ ắ ặ ố ồ"

如果我通过 Powershell 运行它,这就是我得到的:

enter image description here

如果我通过 cmd 运行它,这就是我得到的:

enter image description here

如果我在 Eclipse 中运行它(使用 Aptana Studio 3 插件),这就是我得到的:

enter image description here

是我系统/软件的问题还是Ruby的问题?我怎样才能让它发挥作用?

虽然它适用于 Ideone:http://ideone.com/PdycKH

最佳答案

Ruby 支持它没问题,在文件顶部设置格式是可行的方法。

问题是通过命令行窗口显示。您需要同时使用支持 Unicode 显示的字体和字符页面。

参见 this question关于在 Windows 命令行中执行此操作。

About the chcp command

关于Ruby 显示 unicode 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15507113/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com