lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

..keeping my fingers out of the hot oven, but..

local str= "This might be in Kanji: "..U(1234)..U(5678).." is that enough? :)"

I don't oppose the \U, no I don't. If they do it, also \x (hex input) should be in..


Chris Marrin kirjoitti 29.12.2005 kello 19.17:

Roberto Ierusalimschy wrote:
Translating "U+1234" into a UTF8 sequence is a very small snippet of code.
Sorry my ignorance, but why is such escape sequences so necessary? Are
there so many control chars in unicode? (For non-control chars, a
UTF8-aware editor should be able to put the proper enconding inside the
string, is that right?)

It allows you to add "incidental" characters without the need for a fully functional editor for that language. For instance, when I worked for Sony we had the need to add a few characters of Kanji on occasion. It's not easy to get a Kanji editor setup for a western keyboard, so adding direct unicode was more convenient. There are also some oddball symbols in the upper registers for math and chemistry and such that are easier to add using escapes.

chris marrin                ,""$,          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
,|` mP ,` ,mm ,b" b" ,` ,mm m$ $ ,m ,`P$$ m$` ,b` .` ,mm ,'|$P ,|"1$` ,b $P ,` :$1 b$` ,$: :,`` |$$ ,` $$` ,|` ,$$,,`"$ $ .` :$| b$| _m$`,:` :$1 ,` ,$Pm|` ` :$$,..;"' |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'