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

builder requires textwrappers for valid utf8 in jruby, not in mri (1.5.6-rc2) #784

Closed
ahmeij opened this issue Nov 1, 2012 · 4 comments
Closed

Comments

@ahmeij
Copy link

ahmeij commented Nov 1, 2012

To be able to encode valid utf8 text wrappers must be used under jruby at the moment, see below example:

code

# coding: utf-8
require 'nokogiri'
puts "Nokogiri #{Nokogiri::VERSION}"
puts "No text wrapper:"
puts Nokogiri::XML::Builder.new(encoding: "UTF-8") { |xml| xml.test "test ﺵ " }.to_xml
puts "With text wrapper:"
puts Nokogiri::XML::Builder.new(encoding: "UTF-8") { |xml| xml.test { xml.text "test ﺵ " }}.to_xml

output Jruby 1.7.0

Nokogiri 1.5.6.rc2
No text wrapper:
<?xml version="1.0" encoding="UTF-8"?>
<test>test ? </test>
With text wrapper:
<?xml version="1.0" encoding="UTF-8"?>
<test>test ﺵ </test>

output MRI 1.9.3

Nokogiri 1.5.6.rc2
No text wrapper:
<?xml version="1.0" encoding="UTF-8"?>
<test>test ﺵ </test>
With text wrapper:
<?xml version="1.0" encoding="UTF-8"?>
<test>test ﺵ </test>
@ahmeij
Copy link
Author

ahmeij commented Nov 1, 2012

I tried to find the cause and as far as I can determine the call to encode_special_chars causes the problem, however I have yet to find out what the root cause exactly is.

@jvshahid
Copy link
Member

I cannot reproduce this problem on master. Can you try v1.5.6.rc3 and report if the problem still exists.

@jvshahid
Copy link
Member

jvshahid commented Dec 1, 2012

I'll close this issue. Please feel free to reopen if the problem still exists. I also added a test to make sure that we don't have regression in the future.

@jvshahid jvshahid closed this as completed Dec 1, 2012
jvshahid added a commit that referenced this issue Dec 2, 2012
@ahmeij
Copy link
Author

ahmeij commented Dec 4, 2012

I cannot reproduce the problem on rc3, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants