M
Martin Hess
I've tracked down a problem with a Gem I am trying to use. It turns =20
out that it has some non-ascii characters in it; for example the =20
second quote in the regular expression below is not an ASCII character:
parts =3D self.split( %r/( [:.;?!][ ] | (?:[ ]|^)["=93] )/x )
It produces errors like this:
:in `require': =
/opt/local/lib/ruby1.9/gems/1.9.1/gems/webby-0.9.4/lib/=20
webby/core_ext/string.rb:14: invalid multibyte char (US-ASCII) =20
(SyntaxError)
I fixed it by adding the following to the top of the offending file:
# encoding: utf-8
My questions:
* Is this the preferred fix?
* Is there a way to work around this problem without modifying the Gem?
* Is there an easy way to see if gems have non-ascii source files but =20=
haven't included an encoding comment? Some kind of Ruby warning for =20
instance.
out that it has some non-ascii characters in it; for example the =20
second quote in the regular expression below is not an ASCII character:
parts =3D self.split( %r/( [:.;?!][ ] | (?:[ ]|^)["=93] )/x )
It produces errors like this:
:in `require': =
/opt/local/lib/ruby1.9/gems/1.9.1/gems/webby-0.9.4/lib/=20
webby/core_ext/string.rb:14: invalid multibyte char (US-ASCII) =20
(SyntaxError)
I fixed it by adding the following to the top of the offending file:
# encoding: utf-8
My questions:
* Is this the preferred fix?
* Is there a way to work around this problem without modifying the Gem?
* Is there an easy way to see if gems have non-ascii source files but =20=
haven't included an encoding comment? Some kind of Ruby warning for =20
instance.