| 1 |
This is ustring, a pure-Lua library to handle UTF-8 strings. |
| 2 |
|
| 3 |
It implements generally the same interface as the standard string library, with |
| 4 |
the following differences: |
| 5 |
* Most functions work on codepoints rather than bytes or characters. Yes, this |
| 6 |
means that even though "á" and "á" should appear identical and represent the |
| 7 |
same character, the former is one codepoint (U+00E1) while the latter is two |
| 8 |
(U+0061 U+0301). |
| 9 |
* Added functions isutf8, byteoffset, codepoint, gcodepoint, toNFC, toNFD. |
| 10 |
* No workalike for string.reverse is provided. |
| 11 |
|
| 12 |
Contents: |
| 13 |
* README - This file. |
| 14 |
* ustring.lua - The main file for the library. |
| 15 |
* string.lua - Extend the string metatable with methods from this library. |
| 16 |
* upper.lua - Data table for ustring.upper. |
| 17 |
* lower.lua - Data table for ustring.lower. |
| 18 |
* charsets.lua - Data tables for pattern matching functions. |
| 19 |
* make-tables.php - Regenerate upper.lua and lower.lua using PHP's multibyte |
| 20 |
string library, and charsets.lua using PCRE. |
| 21 |
* normalization-data.lua - Data tables for toNFC and toNFD. |
| 22 |
* make-normalization-table.php - Regenerate normalization-data.lua based on the |
| 23 |
file includes/libs/normal/UtfNormalData.inc from MediaWiki core. |
| 24 |
|
| 25 |
|
| 26 |
This library (consisting of the files described above) is released under the MIT |
| 27 |
License: |
| 28 |
|
| 29 |
Copyright (C) 2012 Brad Jorsch <[email protected]> |
| 30 |
|
| 31 |
Permission is hereby granted, free of charge, to any person |
| 32 |
obtaining a copy of this software and associated documentation |
| 33 |
files (the "Software"), to deal in the Software without |
| 34 |
restriction, including without limitation the rights to use, |
| 35 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 36 |
copies of the Software, and to permit persons to whom the |
| 37 |
Software is furnished to do so, subject to the following |
| 38 |
conditions: |
| 39 |
|
| 40 |
The above copyright notice and this permission notice shall be |
| 41 |
included in all copies or substantial portions of the Software. |
| 42 |
|
| 43 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 44 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 45 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 46 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 47 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 48 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 49 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 50 |
OTHER DEALINGS IN THE SOFTWARE. |
| 51 |
|