How to escape special characters?

1

I need the output to be a special character from an arrow pointing to the right (→) for example, whose Unicode code is U + 1F812. I have tried to write in various ways always with \ or % preceding the Unicode code (similar to writing a tab or breaking line) and get the following error:

>

bash: syntax error near unexpected token '"\u2191"' Home How should the syntax for the output of these special characters be and what UTF-8, UTF-32 etc. should be. interfere with this?

    
asked by anonymous 23.04.2016 / 07:11

2 answers

0

You need to install the library with UTF-8 support, otherwise you will not be able to use it.

If you are going to install by luarocks , check the Lua libraries directory, the files may not be in the required directory.

$ luarocks install utf8
# ou
$ luarocks install lua-utf8

I recommend the first one.

How to use?

utf8 = require "utf8"
seta = utf8.char(2191) -- Nos meus testes o valor 9658 retornou uma seta
print(seta)
    
23.04.2016 / 11:38
1

On Lua 5.3, you can use "\u{2191}" . The keys are required.

Moon 5.3 also includes a utf8 library and you can use utf8.char(2191) .

    
24.04.2016 / 15:49