test/iptc_test.rb in iptcr-0.1.0 vs test/iptc_test.rb in iptcr-0.1.1
- old
+ new
@@ -81,9 +81,15 @@
assert_equal("\e%G".b, iptc["CodedCharacterSet"])
assert_equal(Encoding::UTF_8, iptc["ObjectName"].encoding)
assert_equal("☃".force_encoding("UTF-8"), iptc["ObjectName"])
end
+ def test_iptc_default_encoding_string
+ iptc = IPTCR.parse("\x1c\x02\x05\x00\x01\x80".b, default_encoding: "windows-1252")
+ assert_equal(Encoding::Windows_1252, iptc["ObjectName"].encoding)
+ assert_equal("€", iptc["ObjectName"].encode("utf-8"))
+ end
+
def test_iptc_string_list
iptc = IPTCR.parse("\x1c\x01\x05\x00\x05Hello\x1c\x01\x05\x00\x05World".b)
assert_equal(2, iptc.fields.size)
assert_equal(["Hello", "World"], iptc["Destination"])
end