Advertisement
uriid1

Decode html char ref | Lua

Nov 14th, 2022
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. --[[
  2.     ####--------------------------------####
  3.     #--# Author:   by uriid1            #--#
  4.     #--# License:  GNU GPLv3            #--#
  5.     #--# Telegram: @main_moderator      #--#
  6.     #--# E-mail:   appdurov@gmail.com   #--#
  7.     ####--------------------------------####
  8. --]]
  9.  
  10. local function decode(str)
  11.     local res = ''
  12.     for s in str:gmatch('[^;]+') do
  13.         local num10 = tonumber(s:match("%d+[ABCDEF]?"), 16)
  14.         res = res .. utf8.char(num10)
  15.     end
  16.     return res
  17. end
  18.  
  19. assert(decode('Алмазы') == 'Алмазы', 'Error')
Tags: lua html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement