From 46f60b5967b9a4f93db7c43f82becec56ed60664 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 19 Jan 2022 23:38:44 -0500 Subject: [PATCH] test: failing multibyte unicode test From #2410 --- test/xml/test_c14n.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/xml/test_c14n.rb b/test/xml/test_c14n.rb index ccab61cedd3..379e60f0aff 100644 --- a/test/xml/test_c14n.rb +++ b/test/xml/test_c14n.rb @@ -1,3 +1,4 @@ +# coding: utf-8 # frozen_string_literal: true require "helper" @@ -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(%{𡏅}, nil, "EUC-JP") + + # I do not understand what's going on here + expected = if Nokogiri.jruby? + %{𡏅} + else + %{} + end + + result = doc.canonicalize + assert_equal(expected, result) + end end end end