开发者

Ruby magic comment doesn't work?

开发者 https://www.devze.com 2023-02-19 18:51 出处:网络
Hey, I\'m trying to write hebrew strings on my application. I added # coding: UTF-8 To my first line to change the encoding. When I l开发者_StackOverflow社区aunch my program I get an encoding err

Hey, I'm trying to write hebrew strings on my application. I added

# coding: UTF-8

To my first line to change the encoding. When I l开发者_StackOverflow社区aunch my program I get an encoding error.

Edit - I believe the problem happens only on my computer. I might have done something wrong, It works very well on my laptop \ other computers. If anyone has any idea anyway it would be nice to know.

KCODE doesn't help either.


Are there any blank lines at the beginning of the file? The first line must be a shebang, a coding statement, etc.

Oh, and like @fl00r said if you're not using 1.9.


? I'm not quite sure but I ussualy use this for Cyrillic

$KCODE = 'u'
require 'jcode'


change coding to encoding, I think

# encoding: utf-8

http://pragdave.blogs.pragprog.com/pragdave/2008/04/fun-with-ruby-1.html

0

精彩评论

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