Hi everyone,
I am a Chinese, and I love Love2d very much. I am working on a project about a CCG game.But I am confused in utf-8 code problem.
I use sublime text 3 with a convert to utf8 package. there is no problem in building the project. but when i zip things up to a .love file there comes an error "could not open the file [messy code].png, file do not exist". for example, the file path is "res/pic/你好.png"
I guess the problem is to the Chinese file name.
what can i do to deal with it? just using English file name? or these is some way?
please help me!
A utf-8 question,PLZ help me!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: A utf-8 question,PLZ help me!
using an english name for a file is the easiest way to do it, since i dont think love can load chinese file names.
- ejmr
- Party member
- Posts: 302
- Joined: Fri Jun 01, 2012 7:45 am
- Location: South Carolina, U.S.A.
- Contact:
Re: A utf-8 question,PLZ help me!
I don't have a problem using love.filesystem.load() on filenames that have Japanese and Chinese characters.Doctory wrote:using an english name for a file is the easiest way to do it, since i dont think love can load chinese file names.
@Alexar
Could you please post your '*.love' file? I would like to take a look at it and try to help if I can.
Re: A utf-8 question,PLZ help me!
thanks a lot man. i tried to upload the love file but failed because of bad net connection. will you please send me an email adress?ejmr wrote:I don't have a problem using love.filesystem.load() on filenames that have Japanese and Chinese characters.Doctory wrote:using an english name for a file is the easiest way to do it, since i dont think love can load chinese file names.
@Alexar
Could you please post your '*.love' file? I would like to take a look at it and try to help if I can.
and here's some code i hope could help.
Code: Select all
self.pic_front = love.graphics.newImage("res/pic/"..name..".png")
self.pic_back = love.graphics.newImage("res/pic/"..self.race.."_back"..".png")
self.pic_frame = love.graphics.newImage("res/pic/"..self.race.."_frame".."_"..tostring(self.level)..".png")
self.font=nil
self.color={} --color={r,g,b,a}
Code: Select all
{"贿赂","每拥有一个骷髅+1金币出牌时抽卡","绿","技能",13,1,0,false,{"onPlay",a.corruption,"onPlay",a.drawCard,"onPlay",a.reUse}},
and the file path is
/res/pic/贿赂.png
the question is why i build it in sublime it works but zip the love file it fails... thanks again
- ejmr
- Party member
- Posts: 302
- Joined: Fri Jun 01, 2012 7:45 am
- Location: South Carolina, U.S.A.
- Contact:
Re: A utf-8 question,PLZ help me!
Feel free to email it to me at 'ejmr at plutono dot com'.Alexar wrote: i tried to upload the love file but failed because of bad net connection. will you please send me an email adress?
Re: A utf-8 question,PLZ help me!
Does this problem exists when you execute your .love file and not when you just execute "love ../<folder>"? If so, then maybe you have problem with your compression utility.Alexar wrote:Hi everyone,
I am a Chinese, and I love Love2d very much. I am working on a project about a CCG game.But I am confused in utf-8 code problem.
I use sublime text 3 with a convert to utf8 package. there is no problem in building the project. but when i zip things up to a .love file there comes an error "could not open the file [messy code].png, file do not exist". for example, the file path is "res/pic/你好.png"
I guess the problem is to the Chinese file name.
what can i do to deal with it? just using English file name? or these is some way?
please help me!
EDIT: Oh, I see problem exactly this. Try to use another archiver. But even if you succeeded, I'd suggest you to not use non-english names.
I'm agree with that. I'm personally always trying to stand in the MS-DOS land - ASCII names 8.3 (often have a problem with spaces, long names and non-english letters).Doctory wrote:using an english name for a file is the easiest way to do it ...
Re: A utf-8 question,PLZ help me!
not in the zip process but run the love file.
thanks for the suggestion. i think a simple english file name will fix all the prob.
thanks for the suggestion. i think a simple english file name will fix all the prob.
- zorg
- Party member
- Posts: 3441
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: A utf-8 question,PLZ help me!
In other words, it's most likely that zip archives can't handle utf8 filenames; unfortunately, löve files need to be zips as far as i know, so you can't just use another archiver.arampl wrote:EDIT: Oh, I see problem exactly this. Try to use another archiver. But even if you succeeded, I'd suggest you to not use non-english names.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: A utf-8 question,PLZ help me!
No, no. I mean other tool, not format. On my Xubuntu archiver handles filenames with any letters without problems in zip format.zorg wrote:In other words, it's most likely that zip archives can't handle utf8 filenames; unfortunately, löve files need to be zips as far as i know, so you can't just use another archiver.
And LÖVE uses it without problems too.
Definitely it is not zip format problem nor LÖVE.
P.S. But I never use non-english letters in source code filenames just because it will be easy for other people to search through my code.
Last edited by arampl on Wed Apr 01, 2015 4:47 am, edited 1 time in total.
- ejmr
- Party member
- Posts: 302
- Joined: Fri Jun 01, 2012 7:45 am
- Location: South Carolina, U.S.A.
- Contact:
Re: A utf-8 question,PLZ help me!
When I unzipped the ‘*.love’ file you sent me /res/pic/贿赂.png was not the filename. None of the filenames were in UTF-8. Assuming Chinese is the default language and locale on your computer, is it possible the filenames are instead in BIG5 or GB18030 or one of the other GB-variants? In which case you could add in an extra step to convert them when building the ‘*.love’ archive, but as other people have suggested it would be more simple to use ASCII.Alexar wrote: the tab[1]="贿赂" is the ver name
and the file path is
/res/pic/贿赂.png
Although please don’t restrict yourself to the 8.3 filename format. It’s not 1981 anymore
Who is online
Users browsing this forum: Google [Bot], pgimeno and 20 guests