简体   繁体   English

Ruby Unicode转义中的ASCII空格字符

[英]ASCII Space Character in Ruby Unicode Escape

Doing some reading and came across this block of code on the topic of Unicode Escapes in Ruby: 做一些阅读,并遇到了有关Ruby中Unicode Escapes主题的这段代码:

money = "\\u{20AC 20 A3 20 A5}" # => "€ £ ¥"

I understand that in this ruby syntax, the actual spaces between the {} 's doesn't output an encoded space, that's the reason for the code point 20 but what I don't understand is why there's a code point 20 at the very beginning of the {} , right after the \\u\u003c/code> . 我知道在这种ruby语法中, {}之间的实际空格不会输出编码后的空格,这就是代码点20的原因,但是我不明白的是为什么在这点上有一个代码点20 {}开始,在\\u\u003c/code> 。 No space has been output in the result and I copied it verbatim from the book. 结果中没有输出空间,我从书中逐字复制了它。

It's not a 20 at the beginning, it's 20AC , which is the code point for . 开头不是20 ,而是20AC ,这是的代码点。 The contents of the braces are a space separated list of codepoints (in hex format). 大括号的内容是用空格分隔的代码点列表(十六进制格式)。 20AC is , 20 is a space , A3 is £ and A5 is ¥ . 20AC20是空格A3£A5¥

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

相关问题 Ruby on Rails在搜索中转义Unicode字符 - Ruby on rails escape unicode characters in search 在NetBeans-Ruby中转义unicode符号 - Escape unicode symbols in NetBeans-Ruby Ruby on Rails查询中下划线的转义字符 - Escape character for underscore in Ruby on Rails queries 不兼容的字符编码:Ruby 1.9中的ASCII-8BIT和UTF-8 - incompatible character encodings: ASCII-8BIT and UTF-8 in Ruby 1.9 Ruby异常:`不兼容的字符编码:ASCII-8BIT和UTF-8` - Ruby exception: `incompatible character encodings: ASCII-8BIT and UTF-8` wicked_pdf在unicode pdf转换中显示未知字符(红宝石) - wicked_pdf shows unknown character on unicode pdf conversion (ruby) 来自pdftk Unicode转换结果的ruby 1.8.7中的字符转换 - Character conversion in ruby 1.8.7 from pdftk unicode conversion results 升级到Postgres数据库中的Rails 3和Ruby 1.9以及Unicode数据,现在以ASCII形式返回(潜在错误?) - Upgraded to Rails 3 and Ruby 1.9 and Unicode data in Postgres database now returning as ASCII (potential bug?) Rails 2.3 + Ruby 1.8.7不兼容的字符编码:UTF-8和ASCII-8BIT - Rails 2.3 + Ruby 1.8.7 incompatible character encodings: UTF-8 and ASCII-8BIT Ruby on Rails 3,不兼容的字符编码:带有i18n的UTF-8和ASCII-8BIT - Ruby on Rails 3, incompatible character encodings: UTF-8 and ASCII-8BIT with i18n
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM