When I try to use special french caracters with gosu, it doesn't work (à, À, é,è,ê, É, È, Ê, ô, Ô, etc.).
Is there any solution?
I'm working with ruby 1.9.3, and gous 0.7.45 (with aptana studio 3).
As I know, Ruby doesn't support any Unicode (so I have the same with ą, ę, ó, ż ,ź ł)
I think it's going to be fixed in Ruby 2.0, but maybe there's some gem for this already.
I am German, there is no way Ruby/Gosu would not support our beloved Umlauts äöüß ;)
You have to make sure that you save your files as UTF-8 (not sure how to do this in Aptana Studio), and in Ruby 1.9.x (but not 1.8 or 2.0), you have to start every file with the following comment:
# Encoding: UTF-8.
If you dig deep enough into the Gosu Showcase, I think there is even a game that uses Thai :)
There's no way because no one "smart" and "brave" enough tried to fix it, did you mean ?
Your trick work perfectly (Aptana wasn't a problem). Unfotunatly, I can't put "ç". Programm doesn't freeze, juste stop where it is (wich means that I don't have any error message).
In ruby 1.9.3 for now, should I move on ruby 2.0.0?
Gosu does not yet work with Ruby 2.0.0 (at least not on Windows).
This is not a trick :) This is how Unicode in Ruby 1.9 works. I'll post a screenshot and minimal script from my other computer...
Here's a short test program that uses the ç character - tested on Windows 7 with Ruby 1.9.3 and Gosu 0.7.45. Are you sure Aptana is saving the file as UTF-8? Can you post a short Ruby script that shows the problem?
Well, the problem is else where (after your post, I retry) : when I use the command gets.chomp in order to get the selected language, I tape this : "français", and it's considered as this : "franÃ§ais". Don't get why.
If I juste set the @language var as "français" (before running the program), then, everthing goes fine.
Looks like an encoding problem. What is the
.encoding of the string? I think it may be UTF-8 but with the wrong
.encoding, and when Gosu converts it to UTF-8 it gets converted once again?
It should be like this:
1.9.3p362 :001 > x = gets.chomp
1.9.3p362 :002 > x.encoding
...Looking at the code, I am not sure why I call
force_encoding on the string instead of
Can please you try
gets.chomp.encode("UTF-8") as a workaround?
When I don't touch to anything, I get this : Windows-1252 (franÃ§ais) as encoding type. If I use .encode("UTF-8"), the answer is UTF-8, but "français" still isn't recognized : franÃƒÂ§ais. It's worse. But, with force_encoding, I get this : franÃ§ais. And UTF-8 as answer.
The other stuff (ÀÁÄÂ, etc.) don't work either.
I think you should contact Aptana support and suggest that they use UTF-8 for everything, especially now that it is the default encoding in Ruby 2.0. I am still not sure if Aptana or Gosu is buggy, but if the whole thing was UTF-8 from start to finish, nothing could possibly break.
text.unpack('C*').pack('U*') still work?
Hi, here my resulte with this
@language=gets.chomp.unpack('C*').pack('U*') => français (type), franÃÂ§ais (as result), still UTF-8.
(I use @ just to be sure it won't change, and work what ever happens)
Well, I've tried something else : using the program without my IDE. It's work with no problem.
In fact, in the IRB, it look like this : français => franÃÂ§ais. But, if I ask to put (
puts) the x value, I got this : français. Finally, in my own program, itself, français -> français.
Why is that hard to get a good IDE...
I don't use a real IDE, but I use SciTE: a text editor with some programming friendly features and sometimes I have the same problems, even if SciTE has an option for choosing the file encoding. But if I open the file in Notepad and Save As, selecting the correct encoding, the file now works perfectly in SciTE too. Have you tried this with Aptana?
It was Aptana, badly, but now I'm on EasyEclipse, who doesn't have the problem. I've had to add some plugin though.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill