且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用希伯来语字体修复批处理文件?

更新时间:2023-02-26 12:12:53

似乎您已使用字节顺序标记(BOM)表示希伯来字母Aleph ,其Unicode代码值为05D0.

It looks like you have encoded your batch file with UTF-8 saved without byte order mark (BOM) for Hebrew Letter Aleph with Unicode code value 05D0.

下面的批处理代码复制到不带BOM的UTF-8编码文件中,然后在将字符写入控制台窗口之前将代码页更改为UTF-8(65001).

The batch code below copied into a UTF-8 encoded file without BOM changes the code page to UTF-8 (65001) before the characters are written into the console window.

@echo off
chcp 65001 >nul
ECHO אאאא

除了使用多字节编码UTF-8之外,还可以将单字节编码与

Instead of using multi-byte encoding UTF-8, it would be also possible to use single-byte encoding with code page 862 which contains this letter mapped to code value 80 (hexadecimal, 128 decimal).

@echo off
chcp 862 >nul
ECHO אאאא

代码页862是希伯来语的OEM代码页.

Code page 862 is the OEM code page for Hebrew.

在控制台窗口中,通常使用OEM代码页.如果打开命令提示符窗口并在该窗口中执行chcp,则可以看到默认情况下计算机上设置了哪个代码页.

In console windows usually OEM code pages are used. If you open a command prompt window and execute in this window chcp you can see which code page is by default set on your machine.

但是,根据用于批处理文件的编码在批处理文件中设置正确的代码页并不意味着自动在执行批处理文件时在控制台窗口中正确显示希伯来字母.

But setting the right code page in batch file according to encoding used for the batch file does not automatically mean to get the Hebrew letters now displayed correct in console window on execution of the batch file.

用于控制台窗口的字体也必须分别支持代码页862和Unicode表中的希伯来字母.

The font used for the console window must support code page 862 respectively the Hebrew letters from Unicode table, too.

正如我所看到的那样,在默认情况下使用默认字体光栅字体在命令提示符窗口中显示了希伯来字符错误. .org/wiki/Code_page_850"rel =" nofollow noreferrer>代码页850 在控制台窗口中,我单击了命令提示符窗口标题栏左侧的图标,在属性,然后在字体标签上选择 Consolas .现在显示的希伯来字母与光栅字体不同,但仍然不正确.因此, Consolas 在我的计算机上也不支持希伯来字母.接下来,我尝试使用字体 Lucida Console ,但是希伯来字母再次没有正确显示.换句话说,我的计算机上可用于控制台窗口的3种字体中的任何一种都不能用于在带有正确字形的控制台窗口中显示希伯来字母.

As I saw the Hebrew characters displayed wrong in command prompt window with default font setting Raster Fonts on my English Windows 7 x64 machine using by default code page 850 in console windows, I clicked on icon on left side of title bar of command prompt window, clicked in opened menu on Properties and selected Consolas on tab Font. The Hebrew letters were displayed now different than with Raster Fonts, but still not right. So Consolas also does not support Hebrew letters on my machine. Next I tried font Lucida Console, but again the Hebrew letters were not displayed right. In other words non of the 3 fonts available on my machine for console windows can be used to display the Hebrew letters in a console window with the right glyphs.

阅读此 Unicode简要概述,网址为如果您对文本编码一无所知,可以使用文本编辑器UltraEdit的强大技巧页面.

Read this brief overview of Unicode on a power tip page for text editor UltraEdit if you don't know anything about text encoding.

命令提示符环境不是真正为Unicode设计的.在 Windows控制面板-区域和语言中选择选项卡管理性.在那里,您可以为非Unicode程序设置系统区域设置.此外,还有指向帮助页面的链接,该帮助页面解释了此设置的用途-在选择了希伯来语(以色列)的Windows GUI(Windows-1255)和控制台窗口(OEM 862)中为单字节编码的文本设置默认字体和代码页.

Command prompt environment is not really designed for Unicode. Select in Windows Control Panel - Region and Language the tab Administrative. There you can set system locale for non-Unicode programs. And there is also a link to a help page explaining what this settings is for - setting default font and code page for single byte encoded text in Windows GUI (Windows-1255) and console windows (OEM 862) with Hebrew (Israel) selected.