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

Add ustring Tag Support #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/plist/parser.rb
Expand Up @@ -168,6 +168,12 @@ def to_ruby
end
end

class PUstring < PTag
def to_ruby
CGI::unescapeHTML(text || '')
end
end

class PArray < PTag
def to_ruby
children.collect do |c|
Expand Down
5 changes: 5 additions & 0 deletions test/test_parser.rb
Expand Up @@ -77,6 +77,11 @@ def test_decode_entities
assert_equal('Fish & Chips', data)
end

def test_decode_ustring
data = Plist::parse_xml("<ustring>Fish 'N Chips \u2122</ustring>")
assert_equal("Fish 'N Chips \u2122", data)
end

def test_comment_handling_and_empty_plist
assert_nothing_raised do
assert_nil( Plist::parse_xml( File.read('test/assets/commented.plist') ) )
Expand Down