简体   繁体   English

Windows XP和Ubuntu Linux中的ASCII

[英]ASCII in Windows XP and Ubuntu Linux

I've made a program in MVSC++ which outputs memory contents (in ASCII). 我在MVSC ++中创建了一个程序,用于输出内存内容(ASCII格式)。 The ASCII I see in windows console seem to match what I see in various ASCII tables (smiley, diamond, club, right arrow etc). 我在Windows控制台中看到的ASCII似乎与我在各种ASCII表(笑脸,钻石,俱乐部,右箭头等)中看到的相匹配。 This program needs to compile under Linux (which is does), but the ASCII output looks completely different. 这个程序需要在Linux下编译(确实如此),但ASCII输出看起来完全不同。 A few symbols are the same but the rest are so different. 一些符号是相同的,但其余的是如此不同。 Is there any way to change how terminal displays ASCII code? 有没有办法改变终端显示ASCII代码的方式?

EDIT: The program executes correctly, it's just the ASCII that is being displayed differently. 编辑:程序正确执行,它只是以不同方式显示的ASCII。

ASCII defines character codes from 0x00 through 0x7f. ASCII定义从0x00到0x7f的字符代码。 Everything else (0x80-0xff) is not part of the ASCII standard and depends on what the operating system defines as the characters to display. 其他所有内容(0x80-0xff)不是ASCII标准的一部分,取决于操作系统定义的要显示的字符。 However, the characters you mention (smiley, diamond, club, etc) are the representations of the ASCII "control characters" that don't normally have a visual representation. 但是,您提到的字符(笑脸,钻石,俱乐部等)是ASCII“控制字符”的表示,通常不具有直观表示。 Windows lets you print such characters and see the glyphs it has defined for them, but your Linux is probably interpreting the control characters as formatting control codes (which they are) instead of printing corresponding glyphs. Windows允许您打印这些字符并查看它为它们定义的字形,但您的Linux可能将控制字符解释为格式化控制代码(它们是),而不是打印相应的字形。

What you are seeing is the "extended" character set that IBM initially included when PCs were first unleashed upon the world. 您所看到的是IBM最初在PC首次发布时所包含的“扩展”字符集。 Yes, we are going back to the age of mighty dinosaurs, so bear with me. 是的,我们要回到强大的恐龙时代,所以请耐心等待。 These characters live above $7F and the interpretation of their symbols on the screen can even be influenced by the font chosen. 这些角色的价格高于7F,屏幕上符号的解释甚至会受到所选字体的影响。 Most linux distros are now using UTF-8 (or something close) and as such, the fonts installed may have completely different symbols, or even missing glyphs. 大多数Linux发行版现在都使用UTF-8(或接近的东西),因此,安装的字体可能具有完全不同的符号,甚至缺少字形。 In cases where you are comparing "ASCII" representations (which is a misnomer, as it's not really true ASCII) of the same data, it may or may not exactly match, as you must have the same "glyph" renderings in both display fonts to correctly see similar representations. 如果您正在比较相同数据的“ASCII”表示(这是一个误称,因为它不是真正的ASCII),它可能会或可能不完全匹配,因为您必须在两种显示字体中具有相同的“字形”渲染正确地看到类似的表示。 Try getting both your Windows and Linux installs to use the same font if possible, and then see if there is a change. 尝试让Windows和Linux安装尽可能使用相同的字体,然后查看是否有更改。

If your browser supports Unicode (and you have the correct fonts installed), you will see them bellow. 如果您的浏览器支持Unicode(并且您安装了正确的字体),您将看到它们。 You can copy and paste into an editor with unicode support(Notepad). 您可以复制并粘贴到具有unicode支持的编辑器(记事本)。 Save as UTF-16BE Then if you open in a HexEditor you will see all the unicode codes for each char visible glyph. 保存为UTF-16BE然后,如果在HexEditor中打开,您将看到每个char可见字形的所有unicode代码。 In example the first ascii char Null has Unicode visible glyph 0x2639 in c\\c++\\java you can use it like \☹. 在示例中,第一个ascii char Null在c \\ c ++ \\ java中具有Unicode可见字形0x2639,您可以像\\ u2639一样使用它。 Its not a null char but the visual representation. 它不是null char而是视觉表示。

http://en.wikipedia.org/wiki/Code_page_437 http://en.wikipedia.org/wiki/Code_page_437

☹☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■⓿ ☹☺☻♥♦♣♠•◘○◙♂♀♪♫↕►◄↕!¶§▬↨↑↓→←∟↔▲▼!“#$%&'()* +, - 。/ 0123456789:; <=> @ ABCDEFGHIJKLMNOPQRSTUVWXYZ [] ^ _`ABCDEFGHIJKLMNOPQRSTUVWXYZ?{|}〜⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢¥£₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├ ─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσμτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■⓿

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM