From e984d21f0bc58a8e2b4f828479ea2d6764731c7a Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 4 Dec 2012 13:26:14 +0100 Subject: [PATCH] [api] rely on a fixed xmlhash to convert XML into UTF-8 --- src/api/Gemfile | 2 +- src/api/Gemfile.lock | 4 ++-- src/api/test/unit/package_test.rb | 12 ++++++++++++ src/webui/Gemfile.lock | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/api/Gemfile b/src/api/Gemfile index 2c45c8e18a8..40071348d67 100644 --- a/src/api/Gemfile +++ b/src/api/Gemfile @@ -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' diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock index 77e545f2129..0b79d2c8fc7 100644 --- a/src/api/Gemfile.lock +++ b/src/api/Gemfile.lock @@ -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) @@ -153,5 +153,5 @@ DEPENDENCIES rake (~> 0.9.2) rdoc simplecov-rcov - xmlhash (>= 1.3.3) + xmlhash (>= 1.3.4) yajl-ruby diff --git a/src/api/test/unit/package_test.rb b/src/api/test/unit/package_test.rb index 1e4b5c8e072..7941a033183 100644 --- a/src/api/test/unit/package_test.rb +++ b/src/api/test/unit/package_test.rb @@ -216,4 +216,16 @@ def test_add_user assert @package.valid? end + test "utf8 input" do + xml = ' + libconfig – C/C++ Configuration File Library + 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 — 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). + ' + xh = Xmlhash.parse(xml) + @package.update_from_xml(xh) + end end diff --git a/src/webui/Gemfile.lock b/src/webui/Gemfile.lock index d8100c19be8..a66bb11a285 100644 --- a/src/webui/Gemfile.lock +++ b/src/webui/Gemfile.lock @@ -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)