Open AlexProfi opened 5 years ago
You could try utf8.escape()
I use make with this Makefile
lua-utf8.so:lutf8lib.c
gcc -shared -o lua-utf8.so -I/usr/local/include/luajit-2.1 ./lutf8lib.c -fPIC
then i add this module to cpath in nginx config
I use lua-nginx-module
Then in my code I wrote
local utf8 = require 'lua-utf8'
local i_dn = ngx.var.ssl_client_i_dn_legacy
local sprintf = string.format
local response = sprintf(" ISSUER: %s ,
utf8.escape(i_dn))
ngx.say(response)
i_dn="\U0433.\U041C\U043E\U0441\U043A\U0432\U0430" in above example
And in the logs nginx I get error attempt to index local 'utf8' (a function value) How to fix this
try local utf8 = require("lua-utf8") instead
Thanks errors desappered but I also get this result in output \xD0\xB3.\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0/ I change src of nginx and it resolve issue
hello how to use it like I do it in python s=b"\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0"
but lua 5.1 lua5.1 Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
how to make similar as in python or lua 5.2 with this lib? what function I need to use?