Skip to content

Commit

Permalink
[api] rely on a fixed xmlhash to convert XML into UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Dec 4, 2012
1 parent 35a1cfa commit e984d21
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gem 'delayed_job_active_record'
gem 'exception_notification', '>=2.3'
gem 'yajl-ruby'
gem 'rdoc'
gem 'xmlhash', '>=1.3.3'
gem 'xmlhash', '>=1.3.4'
gem 'fast_xs'
gem 'memcache-client', :require => false
gem 'rake', '~>0.9.2'
Expand Down
4 changes: 2 additions & 2 deletions src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ GEM
http_parser.rb (~> 0.5.1)
simple_oauth (~> 0.1.4)
tzinfo (0.3.35)
xmlhash (1.3.3)
xmlhash (1.3.4)
pkg-config
yajl-ruby (1.1.0)

Expand All @@ -153,5 +153,5 @@ DEPENDENCIES
rake (~> 0.9.2)
rdoc
simplecov-rcov
xmlhash (>= 1.3.3)
xmlhash (>= 1.3.4)
yajl-ruby
12 changes: 12 additions & 0 deletions src/api/test/unit/package_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,16 @@ def test_add_user
assert @package.valid?
end

test "utf8 input" do
xml = '<package name="libconfig" project="home:coolo">
<title>libconfig &#8211; C/C++ Configuration File Library</title>
<description>Libconfig is a simple library for processing structured configuration files, like this one: test.cfg. This file format is more compact and more readable than XML. And unlike XML, it is type-aware, so it is not necessary to do string parsing in application code.
Libconfig is very compact &#8212; just 38K for the stripped C shared library (less than one-fourth the size of the expat XML parser library) and 66K for the stripped C++ shared library. This makes it well-suited for memory-constrained systems like handheld devices.
The library includes bindings for both the C and C++ languages. It works on POSIX-compliant UNIX systems (GNU/Linux, Mac OS X, Solaris, FreeBSD) and Windows (2000, XP and later).</description>
</package>'
xh = Xmlhash.parse(xml)
@package.update_from_xml(xh)
end
end
2 changes: 1 addition & 1 deletion src/webui/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ GEM
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
websocket (1.0.4)
xmlhash (1.3.3)
xmlhash (1.3.4)
pkg-config
xpath (1.0.0)
nokogiri (~> 1.3)
Expand Down

0 comments on commit e984d21

Please sign in to comment.