开发者

Issue with £ character on windows, mac and linux with a ruby script

开发者 https://www.devze.com 2023-02-18 09:41 出处:网络
I have a team of 3 people working on a project. We are all using windows 7 for development and some of have ruby 1.8.7 and some 1.9.2.

I have a team of 3 people working on a project. We are all using windows 7 for development and some of have ruby 1.8.7 and some 1.9.2.

two fo us are exclusively using Aptana Studio, while one of us is using Eclipse.

I keep having an issue with a .rb file that has the £ in it where a unicode character at the beginning of the file causes the ruby parser on my machine to give up on the file with an error.

If I open the file in notepad++ I can change the encoding so it works on my machine, but then it doesn't work on the linux (RHEL) server. I can change the encoding (again) so it works on my dev machine and the server, but then it breaks on my Mac OS X again.

Any ideas what's going on?

Thank开发者_开发问答s Chris


If you have unicode in your code, you need to enable it in ruby 1.9.2 with a "magic comment"

   # encoding: UTF-8

Put this near the top of your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号