Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Cocos代码Ide中使用Lua在中显示Unicode字符串_Unicode_Lua_Cocos2d X_Unicode String - Fatal编程技术网

如何在Cocos代码Ide中使用Lua在中显示Unicode字符串

如何在Cocos代码Ide中使用Lua在中显示Unicode字符串,unicode,lua,cocos2d-x,unicode-string,Unicode,Lua,Cocos2d X,Unicode String,我正在使用Cocos代码IDE创建一个带有Lua的简单项目。 main.lua保存在UTF-8中,没有BOM,包含以下代码段: local label1 = cc.Label:createWithTTF("長い","fonts/Marker Felt.ttf",32); local label2 = cc.Label:createWithTTF("LONG","fonts/Marker Felt.ttf",32); local label3 = cc.Label:createWithTTF("r

我正在使用Cocos代码IDE创建一个带有Lua的简单项目。 main.lua保存在UTF-8中,没有BOM,包含以下代码段:

local label1 = cc.Label:createWithTTF("長い","fonts/Marker Felt.ttf",32);
local label2 = cc.Label:createWithTTF("LONG","fonts/Marker Felt.ttf",32);
local label3 = cc.Label:createWithTTF("rất dài","fonts/Marker Felt.ttf",32);
label1是一个正确呈现的日语字符串,label2也是一个ANSI字符串。但是,label3没有正确渲染。事实上,它被渲染成“rt dái”


我曾尝试使用其他Unicode字体,这些字体显然具有这种特征。尽管如此,我还是无法正确渲染这些角色。我做错了什么?

我也有同样的问题,我已经解决了。 我发现cocos项目中包含的字体文件Marker feel.tff不是unicode版本。因此,过了一段时间,我在Mac PC中找到了Marker Felt字体的unicode版本:System/Library/Fonts/MarkerFelt.ttc


lua 5.1及更低版本不支持utf8 lua 5.1支持utf8。我成功地展示了越南语和中文字符@Ngoc:你收到错误消息了吗?@deathemperor没有错误消息,这就是原因difficult@Ngoc:对我来说,这是我使用的字体。也许你可以试着用其他字体看看。