# utf8_validator.lua **Repository Path**: mirrors_kikito/utf8_validator.lua ## Basic Information - **Project Name**: utf8_validator.lua - **Description**: Easily validating UTF-8 strings in pure Lua - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README utf8_validator.lua ================= This Lua function can be used to validate UTF-8 strings. Usage: local utf8_validator = require 'utf8_validator' local is_valid = utf_validator.validate('This is valid') -- you can also use the shortcut syntax: local is_valid2 = utf_validator('This is also valid') If a string is not valid utf8, then `validate` will also return the position of the first byte that makes it non-valid: local is_valid, error_position = utf_validator(a_binary_blob) if not is_valid then print('non-utf8 sequence detected at position ' .. tostring(error_position)) For valid utf8 strings, `error_position` is always `nil`. Installation ============ Just copy the `utf8_validator.lua` file wherever you need it and `require` it. License ======= This library is MIT-licensed. Specs ===== This library uses [busted](http://olivinelabs.com/busted) for its specs. In order to run them, install `busted` and then: cd path/where/the/spec/folder/is busted