精华内容
下载资源
问答
  • Lua Unicode

    2011-09-22 20:42:00
    From:http://lua-users.org/wiki/LuaUnicode Pattern Matching Lua's pattern matching facilities work character by ... In general, this will not work for Unicode pattern matching, although some t...

    From:http://lua-users.org/wiki/LuaUnicode

    Pattern Matching

    Lua's pattern matching facilities work character by character. In general, this will not work for Unicode pattern matching, although some things will work as you want. For example, "%u" will not match all Unicode upper case letters. You can match individual Unicode characters in a normalized Unicode string, but you might want to worry about combining character sequences. If there are no following combining characters, "a" will match only the letter a in a UTF-8 string. In UTF-16LE you could match "a%z". (Remember that you cannot use \0 in a Lua pattern.)

    Length and string indexing

    If you want to know the length of a Unicode string there are different answers you might want according to the circumstances.

    If you just want to know how many bytes the string occupies, so that you can make space for copying it into a buffer for example, then the existing Lua function string.len will work.

    You might want to know how many Unicode characters are in a string. Depending on the encoding used, a single Unicode character may occupy up to four bytes. Only UTF-32LE and UTF-32BE are constant length encodings (four bytes per character); UTF-32 is mostly a constant length encoding but the first element in a UTF-32 sequence should be a "Byte Order Mark", which does not count as a character. (UTF-32 and variants are part of Unicode with the latest version, Unicode 4.0.)

    Some implementations of UTF-16 assume that all characters are two bytes long, but this has not been true since Unicode version 3.0.

    Happily UTF-8 is designed so that it is relatively easy to count the number of unicode symbols in a string: simply count the number of octets that are in the ranges 0x00 to 0x7f (inclusive) or 0xC2 to 0xF4 (inclusive). (In decimal, 0-127 and 194-244.) These are the codes which can start a UTF-8 character code. Octets 0xC0, 0xC1 and 0xF5 to 0xFF (192, 193 and 245-255) cannot appear in a conforming UTF-8 sequence; octets in the range 0x80 to 0xBF (128-191) can only appear in the second and subsequent octets of a multi-octet encoding. Remember that you cannot use \0 in a Lua pattern.

    For example, you could use the following code snippet to count UTF-8 characters in a string you knew to be conforming (it will incorrectly count some invalid characters):

            local _, count = string.gsub(unicode_string, "[^\128-\193]", "")
    

    If you want to know how many printing columns a Unicode string will occupy when you print it out using a fixed-width font (imagine you are writing something like the Unix ls program that formats its output into several columns), then that is a different answer again. That's because some Unicode characters do not have a printing width, while others are double-width characters. Combining characters are used to add accents to other letters, and generally they do not take up any extra space when printed.

    So that's at least 3 different notions of length that you might want at different times. Lua provides one of them (string.len) the others you'll need to write functions for.

    There's a similar issue with indexing the characters of a string by position. string.sub(s, -3) will return the last 3 bytes of the string which is not necessarily the same as the last three characters of the string, and may or may not be a complete code.

    You could use the following code snippet to iterate over UTF-8 sequences (this will simply skip over most invalid codes):

            for uchar in string.gfind(ustring, "([%z\1-\127\194-\244][\128-\191]*)") do
              -- something
            end
    

    转载于:https://www.cnblogs.com/superchao8/archive/2011/09/22/2185484.html

    展开全文
  • cocos2x-lua unicode 转码

    2015-07-14 06:31:30
    lua中向google请求了一段翻译结果,得到了一行字符串:{"from":"auto","to":"ko","src":"hello","res":"\uc548\ub155\ud558\uc138\uc694"},本来应该是一段直接可以解析的json但是,后面的unicode编码会报错。...
  • 研究了几天,写了一个ANSI UNICODE UTF-8的lua扩展,以便使用 基本上应该还可以用(-_-|) (链接中的永硕网盘提供相应的Unicode.dll下载) 更新历史: 2008-11-3 修正getallfilews函数使用内存浪费问题(分配...

    来源: http://hi.baidu.com/nivrrex/blog/item/17c231adad9e8a0f4b36d6ca.html/cmtid/ccfc7bcbaa7d6012be09e61b

     

    Luacom内部使用的应该是UTF-8编码
    所以直接使用ANSI编码的中文文件名,会打不开
    研究了几天,写了一个ANSI <-> UNICODE <-> UTF-8的lua扩展,以便使用
    基本上应该还可以用(-_-|)
    (链接中的永硕网盘提供相应的Unicode.dll下载)

    更新历史:
         2008-11-3 修正getallfilews函数使用内存浪费问题(分配内存时多分配了1倍)。将wchar_t和char 的大小比值2定义为CHAR_SCALE。getallfilews和getallfilewc返回值最后添加L"/0"。
         2008-11-2 将部分函数提取出来,以便重复使用。更改getallfilew为getallfilewc,添加getallfilews函数,区别是一个为fgetwc实现,一个是fgetws实现,后者速度为前者3-4倍。
         2008-11-1 增加getallfilew和getfilesizew,分别为读取一个Unicode编码文件和一个获取文件大   小的函数
         2008-10-28 修复bug,原因为char 和 wchar_t 类型的问题(汗一个)
         2008-10-27 初次版本,存在bug,调用多次函数后,出现代码崩溃现象(PS:目前测试代码正常,但     如果在调用oExcel.WorkBooks:Open前使用print(a2u8("C://哈哈.xls"))做实验的话,会导致代码失败 ,    慢慢查找原因吧-_-||| 。是C代码内存泄漏?还是Lua 堆栈问题?)

    C代码如下:

    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    #include <windows.h>

    #define BUFF_SIZE 1024
    #define CHAR_SCALE (sizeof(wchar_t)/sizeof(char))

    wchar_t * AToU( const char* str )
    {
         int       textlen ;
         wchar_t * result;
         textlen = MultiByteToWideChar( CP_ACP, 0, str,-1,       NULL,0 );
         result = (wchar_t *)malloc((textlen+1)*sizeof(wchar_t));
         memset(result,0,(textlen+1)*sizeof(wchar_t));
         MultiByteToWideChar(CP_ACP, 0,str,-1,(LPWSTR)result,textlen );
         return       result;
    }
    char * UToA( const wchar_t *str )
    {
         char * result;
         int textlen;
         // wide char to multi char
         textlen = WideCharToMultiByte( CP_ACP,       0,       str,       -1,       NULL, 0, NULL,   NULL    );
         result =(char *)malloc((textlen+1)*sizeof(char));
         memset( result, 0, sizeof(char) * ( textlen + 1 ) );
         WideCharToMultiByte( CP_ACP, 0, str, -1, result, textlen, NULL, NULL );
         return result;
    }
    wchar_t * U8ToU( const char* str )
    {
         int       textlen ;
         wchar_t * result;
         textlen = MultiByteToWideChar( CP_UTF8, 0, str,-1,       NULL,0 );
         result = (wchar_t *)malloc((textlen+1)*sizeof(wchar_t));
         memset(result,0,(textlen+1)*sizeof(wchar_t));
         MultiByteToWideChar(CP_UTF8, 0,str,-1,(LPWSTR)result,textlen );
         return       result;
    }
    char * UToU8( const wchar_t *str )
    {
         char * result;
         int textlen;
         // wide char to multi char
         textlen = WideCharToMultiByte( CP_UTF8,       0,       str,       -1,       NULL, 0, NULL,   NULL    );
         result =(char *)malloc((textlen+1)*sizeof(char));
         memset(result, 0, sizeof(char) * ( textlen + 1 ) );
         WideCharToMultiByte( CP_UTF8, 0, str, -1, result, textlen, NULL, NULL );
         return result;
    }

    static int Unicode_a2u(lua_State *L)
    {
         const char* str;
         wchar_t* result;
         /*传递第一个参数*/
         str = lua_tostring(L, -1);
         /*开始转换*/
         result = AToU(str);
         /*返回值,*/
         lua_pushlstring(L, (char*)result,wcslen(result)*CHAR_SCALE);
         return 1;
    }

    static int Unicode_u2a(lua_State *L)
    {
         const wchar_t* str;
         char* result;
         /*传递第一个参数*/
         str = (wchar_t *)lua_tostring(L, -1);
         /*开始转换*/
         result = UToA(str);
         /*返回值,*/
         lua_pushstring(L, result);
         return 1;
    }

    static int Unicode_u2u8(lua_State *L)
    {
         const wchar_t* str;
         char* result;
         /*传递第一个参数*/
         str = (wchar_t*)lua_tostring(L, -1);
         /*开始转换*/
         result = UToU8(str);
         /*返回值,*/
         lua_pushstring(L, result);
         return 1;
    }

    static int Unicode_u82u(lua_State *L)
    {
         const char* str;
         wchar_t * result;
         /*传递第一个参数*/
         str = lua_tostring(L, -1);
         /*开始转换*/
         result = U8ToU(str);
         /*返回值,*/
         lua_pushlstring(L, (char*)result,wcslen(result)*CHAR_SCALE);
         return 1;
    }

    static int Unicode_a2u8(lua_State *L)
    {
         const char* str;
         wchar_t * temp;
         char* result;
         /*传递第一个参数*/
         str = lua_tostring(L, -1);
         /*开始转换*/
         temp = AToU(str);
         result = UToU8(temp);
         /*返回值,*/
         lua_pushstring(L, result);
         return 1;
    }

    static int Unicode_u82a(lua_State *L)
    {
         const char* str;
         wchar_t * temp;
         char* result;
         /*传递第一个参数*/
         str = lua_tostring(L, -1);
         /*开始转换*/
         temp = U8ToU(str);
         result = UToA(temp);
         /*返回值,*/
         lua_pushstring(L, result);
         return 1;
    }
    /*获取一个文件大小*/
    static int _GetFileSize(const char* filename)
    {
         long len;
         FILE * fp;
         /*用只读打开文件并seek到文件末尾的方式获取文件大小*/
         if ((fp = fopen(filename, "r")) == NULL)
         {
             printf("%s is not invalid/n",filename);
             return 0;
         }
         fseek(fp, 0, SEEK_END);
         len = ftell(fp);
         fclose(fp);
         return len;
    }
    /*Lua 获取 文件大小*/
    static int GetFileSizeW(lua_State *L)
    {
         /*传递第一个参数,文件名*/
         const char* filename = lua_tostring(L, -1);
         lua_pushinteger(L, _GetFileSize(filename));
         return 1;
    }

    /*读取一个Unicode文件,使用fgetwc函数,IO导致速度较慢*/
    static int GetAllFileWC(lua_State *L)
    {
         /*传递第一个参数,文件名*/
         const char* filename = lua_tostring(L, -1);
         /*获取文件大小*/
         int len;
         len = _GetFileSize(filename);
         /*设置缓存大小*/
         wchar_t * buf;
         /*由于wchar_t长度为char长度一倍,所以buf空间大小为文件长度一半,再加末尾的 '/0'*/
         buf = (wchar_t *) malloc (sizeof(wchar_t) * (len/CHAR_SCALE+1));

         int i = 0 ;
         FILE*      input=fopen( filename, "rb");
         while(!feof(input))
         {
             buf[i++]=fgetwc(input);
         }
         /*字符串末尾置零*/
         buf[i-1]=L'/0';
         lua_pushlstring(L, (char*)buf,wcslen(buf)*CHAR_SCALE);
         return 1;
    }
    /*读取一个Unicode文件,使用fgetws函数,速度较快*/
    static int GetAllFileWS(lua_State *L)
    {
         /*传递第一个参数,文件名*/
         const char* filename = lua_tostring(L, -1);
         /*获取文件大小*/
         FILE*     input=fopen( filename, "rb");
         int len = _GetFileSize(filename);
         /*初始化变量*/
         wchar_t *all ;
         all = (wchar_t *)malloc(sizeof(wchar_t)*(len/CHAR_SCALE+1));
         memset(all, 0, sizeof(wchar_t) * (len/CHAR_SCALE+1) );

         int i=0;
         while(!feof(input))
         {
             wchar_t *    buf;
             buf = (wchar_t *)malloc(sizeof(wchar_t)*BUFF_SIZE)          ;
             memset(buf,    0, sizeof(wchar_t) * BUFF_SIZE );

             int j=0;
             fgetws(buf,    BUFF_SIZE,    input);
             /*连接缓存空间,原先使用wcscat连接,但是很慢且有问题,使用指针后速度很快*/
             while(buf[j] != L'/0')
             {
                 all[i++]=buf[j++];
             }
             free(buf);
         }
         all[len/CHAR_SCALE]=L'/0';
         lua_pushlstring(L, (char*)all,wcslen(all)*CHAR_SCALE);
         return 1;
    }

    static const luaL_reg UnicodeFunctions [] =
    {
         {"a2u",Unicode_a2u},
         {"u2a",Unicode_u2a},
         {"u2u8",Unicode_u2u8},
         {"u82u",Unicode_u82u},
         {"a2u8",Unicode_a2u8},
         {"u82a",Unicode_u82a},
         {"getfilesizew",GetFileSizeW},
         {"getallfilewc",GetAllFileWC},
         {"getallfilews",GetAllFileWS},
         {NULL, NULL}
    };

    int __cdecl __declspec(dllexport) luaopen_Unicode(lua_State* L)
    {
         luaL_openlib(L, "Unicode", UnicodeFunctions, 0);
         return 1;
    }


    Lua调用代码如下:

    --假定dll文件位于C:/Unicode.dll
    --假定中文路径的文件名为C:/哈哈.xls
    --假定C:/Unicode.csv为一个UTF-16LE编码文件
    require "luacom"
    local unicode = package.loadlib("C://Unicode.dll","luaopen_Unicode")

    if(unicode)then
        unicode()
        print("OK!")
    else
        print("Not found!")
        -- Error
    end

    a2u =Unicode.a2u
    u2a =Unicode.u2a
    u2u8 =Unicode.u2u8
    u82u =Unicode.u82u
    u82a =Unicode.u82a
    a2u8 =Unicode.a2u8
    getallfilewc = Unicode.getallfilewc
    getallfilews = Unicode.getallfilews
    getfilesizew= Unicode.getfilesizew

    print(getfilesizew("C://Unicode.csv"))

    local x = os.clock()
    getallfilewc("C://Unicode.csv")
    print(string.format("elapsed time: %.2f/n",os.clock() - x ))
    local x = os.clock()
    getallfilews("C://Unicode.csv")
    print(string.format("elapsed time: %.2f/n",os.clock() - x ))

    print(a2u8("哈哈.xls"))

    local oExcel = luacom.CreateObject("Excel.Application")
    if oExcel == nil then error("Object is not create") end
    oExcel.Visible = 1
    oExcel.WorkBooks:Open(a2u8("C://哈哈.xls"),nil,0)
    oExcel.ActiveWorkbook.Sheets(1):Select()

     

    展开全文
  • -- value: Unicode值 -- str : Unicode值对应字符 GameUtils.UnicodeToUTF_8Str = function(value) local str -- 先把Unicode值表示二进制转成Utf_8格式, 在string.char返回字符 if value < 128 then -- ...

    -- value: Unicode值
    -- str  : Unicode值对应字符
    GameUtils.UnicodeToUTF_8Str = function(value)
        local str
        -- 先把Unicode值表示二进制转成Utf_8格式, 在string.char返回字符
        if value < 128 then -- (Utf_8格式 = [0xxxxxxx])(128 = 1 0000000)
            str = string.char(value)
        elseif value < 2048 then -- (Utf_8格式 = [110xxxxx]-[10xxxxxx]) (2048 = 1 00000 000000)
            local byte1 = 128 + value % 64
            local byte2 = 192 + math.floor(value / 64)
            str = string.char(byte2, byte1)
        elseif value < 65536 then -- (Utf_8格式 = [1110xxxx]-[10xxxxxx]-[10xxxxxx]) (65536 = 1 0000 000000 000000)
            local byte1 = 128 + value % 64
            local byte2 = 128 + (math.floor(value / 64) % 32)
            local byte3 = 224 + (math.floor(value / 4096) % 16)
            str = string.char(byte3, byte2, byte1)
        end
        return str
    end

    展开全文
  • 说说最近的几个事情1.project采用lua,ui模块肯定是要彻底使用utf-16的,可是lua不支持,怎么办?最后好像是写了userdata,可以将multibytes转成utf-16保存在这个userdata中;...2.google:lua unicode,...

    说说最近的几个事情
    1.project采用lua,ui模块肯定是要彻底使用utf-16的,可是lua不支持,怎么办?最后好像是写了userdata,可以将multibytes转成utf-16保存在这个userdata中;接着为了保证字符串相同的userdata做key时是相同的,于是又添加了相应的避免重复功能;最后还为这个userdata在gc方面作了保证。
    2.google:lua unicode,会发现一份通过table使用unicode的文章传得很广,实际上很不实用——需要工具,字符串不可读。
    3.魔兽世界的lua脚本保存格式为utf-8,他的脚本中有一段是直接写文字信息的,所以这种保存格式比较有利。
    4.看过战锤OL的插件,无意中看到类似   s = L"战锤OL"  的代码,心想难道lua支持unicode了?试了一下发现没有,于是觉得是不是他们的程序修改了lua的parser了。不久后的现在,脑袋终于开窍了。

    其实不少实力派的前人早就强调过lua在unicode方面的解决方案了:lua string是一个raw buffer,可以存放任意数据。这个说法虽然正确却太抽象,因为他们都没有交代过具体的实现手法。
    我们想要的所谓支持unicode的lua,到底是什么意思呢,最基础的大概就是能像c那样,用L作为字符串的前缀,并能将字符串赋值到变量上,就像上面的
    s = L"战锤OL"
    注意这句代码,你看出什么了吗?再明确一些
    s = L("战锤OL")
    感谢lua这种可忽略的写法,可以让lua写一些很漂亮的内容,除了string,还有table。
    只要L是一个函数,接受multibytes字符串作为参数,转化为utf-16,然后将utf-16的字符串交给lua string,压栈。
    这里要回头说说最上面所说的project,我不需要userdata了,因为他可以是一个lua string,相同的字符串做key的同质性?gc?通通都交给lua string吧,这里没你的事了。

    最后,贴一下代码,收功

     1None.gifint utf8_to_utf16(lua_State* L)
     2ExpandedBlockStart.gifContractedBlock.gifdot.gif{
     3InBlock.gif    size_t n = 0;
     4InBlock.gif    char* str = (char*)luaL_checklstring(L, -1&n);
     5InBlock.gif    if(!str) 
     6InBlock.gif        return 0;
     7InBlock.gif
     8InBlock.gif    iconv_t h = iconv_open("utf-16""utf-8");
     9InBlock.gif    if(0==h) 
    10InBlock.gif        return 0;
    11InBlock.gif    
    12InBlock.gif    char wstr[4096];
    13InBlock.gif    size_t wn = 4096;
    14InBlock.gif    char** ppsrc = &str;
    15InBlock.gif    char* dst = wstr;
    16InBlock.gif    char** ppdst = &dst;
    17InBlock.gif    int ret = iconv(h, ppsrc, &n, ppdst, &wn);
    18InBlock.gif    if(ret==-1 || wn<0 || n>0)
    19ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
    20InBlock.gif        iconv_close(h);
    21InBlock.gif        return 0;
    22ExpandedSubBlockEnd.gif    }

    23InBlock.gif    iconv_close(h);
    24InBlock.gif
    25InBlock.gif    lua_pushlstring(L, (char*)wstr, (4096-wn));
    26InBlock.gif    return 1;
    27ExpandedBlockEnd.gif}

    28None.gif
    29None.gif
    30None.gif//here here
    31None.giflua_register(L, "L", utf8_to_utf16);

    转载于:https://www.cnblogs.com/happydpc/archive/2010/09/14/1825918.html

    展开全文
  • Lua脚本中使用Unicode

    千次阅读 2015-04-19 09:37:39
    如何在lua脚本中使用Unicode是本文要介绍的内容,主要是来学习Unicodelua脚本中如何使用,具体内容来看本文详细内容讲解。说说最近的几个事情: 1、project采用lua,ui模块肯定是要彻底使用utf-16的,可是lua不...
  • lua utf8 unicode ansi 转换

    热门讨论 2012-03-06 00:40:57
    a2w(ansi to unicode) u2w(utf8 to unicode) w2a(unicode to ansi) w2u(unicode to utf8) u2a(utf8 to ansi) a2u(ansi to utf8) bstr(bytes of str) help(show this) wunoman@qq.com 2012/03/06
  • 开始学习LUA,在LUA中使用UNICODE字符串

    千次阅读 2008-12-05 00:30:00
    新买到LUA程序设计(第2版)开始学习LUA程序设计。 今天测试用LUA调用windows的MessageBoxW函数。需要在LUA中定义UNICODE字符串。...如字符串"LUA"如果使用UNICODELUA中表示为: Code highlighting p
  • lua中使用unicode

    2012-03-21 15:46:52
    UI模块是unicode lua是ansi 现在是程序底层的数据是unicode类型,传给lua 然后lua再传给程序的界面 界面也是unicode 中间经过lua 一转换。数据就出错了。 如何让lua也支持unicode格式呢?
  • <div><p>We tried to use unicode characters in luerl but found that is seems like unicode encoded twice. I've found it is because of the usage the unicode:characters_to_binary(Cs2, unicode, unicode...
  • Lua中使用Unicode

    千次阅读 2008-12-06 21:57:00
    这是一个事实上已经解决的,但是却很难搜索到方案的问题。在这点上不得不佩服老外的兜圈子和...这点也怪不得人家,Unicode的问题对于东亚语系才是不得不解决的问题。倒是中文资料总是三言两语带过,确实让人很愤懑。
  • lua脚本中使用unicode

    千次阅读 2014-02-23 18:29:16
    说说最近的几个事情1.project采用lua,ui模块肯定是要彻底使用utf-16的,可是lua不支持,怎么办?最后好像是写了userdata,可以将multibytes转成utf-16保存在这个userdata中;接着为了保证字符串相同的userdata做key...
  • in unicode_why_string_length_different_eval_vs_dofile(Config) we realised an exciting behaviour of Luerl: <p>same string with special characters give back different string length from same lua code, ...
  • 在使用LuaXml解析xml报文时,如果xml报文中带有unicode编码,解码后依然是unicode编码,无法被解析成实际的内容,这种情况需要修改Lua_XML_lib.c,修改如下将251行到257行替换成如下内容: while(pos &...
  • 但是使用decode接口时出现了unicode乱码问题。 编译生成pbc.a和protobuf.so时我均采用了luajit编译,并且添加了-fPIC选项,如下: gcc -O2 -Wall --shared -fPIC -o protobuf.so -I../.. -I/usr...
  • lua中怎么从utf16转到utf8 ? 从网上找到个js的实现方法,但是不知道参数是什么, ``` function utf16ToUtf8(s){ if(!s){ return; } var i, code, ret = [], len = s.length; for(i = 0; i ; i++){ ...
  • Unicode与UTF-8互转(c语言和lua语言)

    千次阅读 2018-02-02 14:37:15
     对于单字节的符号, 字节的第一位设为0, 后面7位为这个符号的unicode码. 因此对于  英语字母, UTF-8编码和ASCII码是同样的. 2)  对于n字节的符号 (n>1) , 第一个字节的前n位都设为1, 第n+1位设为0, 后面...
  • --(c>=48 and c<=57)数字 --(c>= 65 and c<=90)大写字母 --(c>=97 and c<=122)小写字母 ...--判断是否由汉字,大小写字母组成 ...function Balance:GetStringA_Z_Chinese(str) ...whil...
  • - Lua unicode strings are converted to wstrings when C++ function expects wstring. This might be desired when code is written for Win32 - C++ functions can <code>throw LuaNil()</code> ...
  • JSON库 ...其中cjson的语法严格(比如unicode \u0020\u7eaf),要求符合规范否则会解析失败(如\u002),而dkjson相对宽松,当然也可以通过修改cjson的源码来完成一些特殊要求。而在使用dkjson时也...
  • LuaUnicode icu-lua

    2010-08-23 23:56:56
    Unicode is a large and complex standard and questions like "does lua support unicode" are extremely vague. Some of the issues are: Can I store and retrieve Unicode strings? Can my Lua programs ...
  • 因为com内部是 unicode的,于是luacom要求所有输入都是utf-8的,而且luacom的输出也是utf-8的。这可肿么办啊?iconvGNU有个libiconv库,要是有这个我们就不怕了! luaforge上搜索下,果然有lua-iconv,安装!luar...
  • Cstring Unicode转非Unicode

    2017-02-16 15:43:59
    使用UNICODE字符集编程时,总是需要使用那些不支持UNICODE的库,例如sqlite3,Lua等必须使用char*类型的。这个时候用CStringA是最好的。 另外CStringA与CString可以灵活地随意转换赋值,注意不能这样用: ...
  • How to upgrade lua

    2020-12-09 06:13:30
    <p>And we also have <code>re</code> and <code>unicode, which are wrapper for boost functions. <p>The whole thing that prevents us from upgrading Lua is we do not know what functions are used by people...
  • CEGUI Lua 编码

    2019-10-08 22:38:26
    CEGUI使用的是UTF-8编码lua 使用的是ascii 编码UTF-8编码是以一个字节为"基本单元",在表示7位ASCII字符表中的字符时,这个字符在UFT-8的格式中占一个字节,即,一个"基本单元",而在表示汉字的时候,UTF-8格式要...
  • lua的一些错误

    2019-07-25 12:41:08
    Q1.在使用lua的require模块时,1.默认编码简体中文GB...将编码改成Unicode(utf-8带签名)-代码页65001,就会报错: LuaException:errorloadingmoduleget_morefrompersistentDataPath,get_more.lua:1:unexpecte...
  • lua 和c的调用

    2017-03-15 17:47:15
    lua中使用c动态库,像luacjson(支持unicode),luasocket,都是以动态链接库的形式在lua中使用的,至于怎么写这些动态链接库很少有教程说到,下面我就说说如何把c文件编译成动态库。首先,假设需要在lua中调用一个在...
  • lua2json

    2013-11-26 21:56:00
    lua对象json序列化,很简单,没做中文的unicode编码了 local function bool2json(v) return v and "true" or "false";end local function string2json(s) return table.concat({"\"", s, "\""});end local ...

空空如也

空空如也

1 2 3 4 5 ... 12
收藏数 233
精华内容 93
关键字:

luaunicode