Code Monkey home page Code Monkey logo

lua-resty-unicode's Introduction

Name

lua-resty-unicode - This library provides the mutual conversion of Unicode and UTF-8.

Table of Contents

Status

This library is production ready.

Require

  • bit library
  1. Download from LuaBitOp and compile.
  2. Or you can use the 'bit.so' provided by the library itself

Synopsis

local unicode = require "unicode"

-- unicode to utf-8
print(unicode.decode('\\u0041'))    -- A

-- support url-encode: '%u'
print(unicode.decode('%u0041'))     -- A

-- support mixing
print(unicode.decode('s\\u0065l\\u0065ct * fr%u006fm'))  -- select * from

-- A variety of encoding text
print(unicode.decode('%u0045%u006e%u0067%u006c%u0069%u0073%u0068'))
print(unicode.encode('English'))

print(unicode.decode('\\u6c49\\u5b57'))
print(unicode.encode('汉字'))
print(unicode.decode('\\u6f22\\u5b57'))
print(unicode.encode('漢字'))

print(unicode.decode('\\u0440\\u0443\\u0441\\u0441\\u043a\\u0438\\u0439\\u0020\\u0020\\u0442\\u0435\\u043a\\u0441\\u0442'))
print(unicode.encode('русский  текст'))

print(unicode.decode('\\u0628\\u0627\\u0644\\u0639\\u0631\\u0628\\u064a\\u0629'))
print(unicode.encode('بالعربية'))
A
A
select * from
English
\u0045\u006e\u0067\u006c\u0069\u0073\u0068
汉字
\u6c49\u5b57
漢字
\u6f22\u5b57
русский  текст
\u0440\u0443\u0441\u0441\u043a\u0438\u0439\u0020\u0020\u0442\u0435\u043a\u0441\u0442
بالعربية
\u0628\u0627\u0644\u0639\u0631\u0628\u064a\u0629

lua-resty-unicode's People

Contributors

perfgao avatar killsen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.