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

jruby: use a modern c14n library #2547

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: failing multibyte unicode test
From #2410
  • Loading branch information
flavorjones committed Oct 16, 2022
commit 7b7b1d593e8937ac65a74b809fa8783b17556ab2
16 changes: 16 additions & 0 deletions test/xml/test_c14n.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# coding: utf-8
# frozen_string_literal: true

require "helper"
Expand Down Expand Up @@ -237,6 +238,21 @@ def test_wrong_params
assert_raises(TypeError) { doc.canonicalize(nil, :wrong_type) }
doc.canonicalize(nil, nil, :wrong_type)
end

def test_multibyte_unicode
# https://github.com/sparklemotion/nokogiri/issues/2410
doc = Nokogiri.XML(%{<foo>𡏅</foo>}, nil, "EUC-JP")

# I do not understand what's going on here
expected = if Nokogiri.jruby?
%{<foo>𡏅</foo>}
else
%{<foo>陝</foo>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I really have no idea why this is different. Maybe @AlexSun1995 has some insight, since he reported this in #2410

end

result = doc.canonicalize
assert_equal(expected, result)
end
end
end
end