Notepad++ 只是称为“ANSI"的编码,有没有人知道 Ruby 该怎么称呼它? [英] The encoding that Notepad++ just calls "ANSI", does anyone know what to call it for Ruby?

查看:31
本文介绍了Notepad++ 只是称为“ANSI"的编码,有没有人知道 Ruby 该怎么称呼它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆 .txt,Notepad++ 说(在它的编码"下拉菜单中)是ANSI".

I have a bunch of .txt's that Notepad++ says (in its drop-down "Encoding" menu) are "ANSI".

其中包含德语字符 [äöüß],在 Notepad++ 中显示良好.

They have German characters in them, [äöüß], which display fine in Notepad++.

但是当我 File.read 'this is a German text example.txt' 时,它们并没有直接出现在 irb 中.

But they don't show up right in irb when I File.read 'this is a German text example.txt' them.

那么有谁知道我应该给 Encoding.default_external= 什么参数?

So does anyone know what argument I should give Encoding.default_external=?

(我假设这就是解决方案,对吗?)

(I'm assuming that'd be the solution, right?)

'utf-8''cp850' 时,它读取带有äöüß"的ANSI"文件为xE4xF6xFCxDF"...

When 'utf-8' or 'cp850', it reads the "ANSI" file with "äöüß" in it as "xE4xF6xFCxDF"...

(请不要犹豫,在你的答案中提及明显显而易见"的事情;我和你一样新手,但仍然知道足以提出这个问题.)

(Please don't hesitate to mention apparently "obvious" things in your answers; I'm pretty much as newbish as you can be and still know just enough to ask this question.)

推荐答案

它们的意思可能是 ISO/IEC 8859-1 (aka Latin-1)、ISO-8859-1、ISO/IEC 8859-15 (aka Latin-1)-9) 或 Windows-1252(又名 CP 1252).所有 4 个都在 0xE4 位置具有 ä.

What they mean is probably ISO/IEC 8859-1 (aka Latin-1), ISO-8859-1, ISO/IEC 8859-15 (aka Latin-9) or Windows-1252 (aka CP 1252). All 4 of them have the ä at position 0xE4.

这篇关于Notepad++ 只是称为“ANSI"的编码,有没有人知道 Ruby 该怎么称呼它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆