I'm losing my mind over this very simple problem. Let's consider the 2 following attempts to print the character └
from the lua interpreter:
1)
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> print(utf8.char(2514))
2)
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> print("└")
└
First problem is that for some reason only option 2) actually works. But my real problem is that when I am running a script that does some printing using option 2) it actually prints the same gibberish as seen in option 1). This leads me to my main question, why?
For info I'm simply running the script using the following command:
./lua53 path_to_my_script.lua
I feel like I am missing something very silly somewhere, yet I haven't been able to figure it out. Any help would be greatly appreciated.
Thanks!
2514 is the hexadecimal code of that Unicode character (see here).
Use
print(utf8.char(0x2514))
or
print("\u{2514}")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With