Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding::CompatibilityError exception using UTF-8 locals with Haml on JRuby (1.9 mode) #83

Closed
aXe1 opened this issue Apr 28, 2011 · 3 comments
Milestone

Comments

@aXe1
Copy link

aXe1 commented Apr 28, 2011

When using non-ASCII locals (e.g. cyrillic) in souce encoded in UTF-8 without BOM and Haml template (must include non-ASCII characters too) UTF-8 - Encoding::CompatibilityError exception raises.

tilt1.rb (UTF-8 without BOM):

# encoding: utf-8
require 'haml'
require 'tilt'

template = Tilt.new('tilt1.haml')
puts template.render(self, :test_var => 'проверка')

tilt1.haml (UTF-8 without BOM):

-# encoding: utf-8
%p проверка
%p= test_var

Running on JRuby with command-line parameter --1.9 causes exception, but with --1.8 command-line parameter or on MRI Ruby it works as expected.

C:\aXe1\dev\ruby\test\jruby>jruby --1.9 tilt1.rb
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and U
TF-8
  evaluate_source at tilt1.haml:3
             eval at org/jruby/RubyKernel.java:1093
  evaluate_source at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/template.rb:225
    instance_eval at org/jruby/RubyBasicObject.java:1699
  evaluate_source at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/template.rb:225
  cached_evaluate at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/template.rb:144
         evaluate at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/template.rb:127
         evaluate at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/haml.rb:24
           render at c:/jruby/jruby-1.6.1/lib/ruby/gems/1.9/gems/tilt-1.3/lib/ti
lt/template.rb:76
           (root) at tilt1.rb:7

C:\aXe1\dev\ruby\test\jruby>jruby --1.8 tilt1.rb
<p>╨┐╤А╨╛╨▓╨╡╤А╨║╨░</p>
<p>╨┐╤А╨╛╨▓╨╡╤А╨║╨░</p>

C:\aXe1\dev\ruby\test\jruby>ruby tilt1.rb
<p>╨┐╤А╨╛╨▓╨╡╤А╨║╨░</p>
<p>╨┐╤А╨╛╨▓╨╡╤А╨║╨░</p>

Don't see on incorrect characters above - it's ok, cause my console has CP866 encoding and not UTF-8.
Similar template in Erb works ok.

My environment:

C:\aXe1\dev\ruby\test\jruby>jgem list tilt

*** LOCAL GEMS ***

tilt (1.3)

C:\aXe1\dev\ruby\test\jruby>jgem list haml

*** LOCAL GEMS ***

haml (3.1.1)

C:\aXe1\dev\ruby\test\jruby>jruby -v
jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 1
.6.0_21) [Windows 7-x86-java]

C:\aXe1\dev\ruby\test\jruby>ruby -v
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
@rkh
Copy link
Collaborator

rkh commented Apr 29, 2011

Does it work on MRI 1.9? If so, please file a JRuby issue.

@aXe1
Copy link
Author

aXe1 commented Apr 29, 2011

Yes. Both on MRI 1.9 and JRuby in 1.8 mode.
Maybe it is related to [#JRUBY-5754].

@judofyr
Copy link
Collaborator

judofyr commented Apr 28, 2013

Try again with Tilt from master. Re-open if this is still occurs.

@judofyr judofyr closed this as completed Apr 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants