summaryrefslogtreecommitdiffstats
path: root/lib/puppet/external
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-10-18 12:01:29 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-10-18 12:01:29 -0700
commit19ae3dffa4e52e752149ce90ebf83f9055c2313b (patch)
treef5cf31b9d5c45a199dbb9795482efb08e3c8afb7 /lib/puppet/external
parent2d13fdaac56bd5cd57444cc4447081649e18f487 (diff)
parente3fc5b95d133aee1ae3dc188e6c47e88786dfc6e (diff)
downloadpuppet-19ae3dffa4e52e752149ce90ebf83f9055c2313b.tar.gz
puppet-19ae3dffa4e52e752149ce90ebf83f9055c2313b.tar.xz
puppet-19ae3dffa4e52e752149ce90ebf83f9055c2313b.zip
Merge commit '2.6.3rc1' into next
Diffstat (limited to 'lib/puppet/external')
-rw-r--r--lib/puppet/external/pson/pure/generator.rb17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/puppet/external/pson/pure/generator.rb b/lib/puppet/external/pson/pure/generator.rb
index ef8b36d31..4180be57d 100644
--- a/lib/puppet/external/pson/pure/generator.rb
+++ b/lib/puppet/external/pson/pure/generator.rb
@@ -63,22 +63,15 @@ module PSON
end
else
def utf8_to_pson(string) # :nodoc:
- string = string.gsub(/["\\\x0-\x1f]/) { MAP[$MATCH] }
- string.gsub!(/(
- (?:
+ string.
+ gsub(/["\\\x0-\x1f]/n) { MAP[$MATCH] }.
+ gsub(/((?:
[\xc2-\xdf][\x80-\xbf] |
[\xe0-\xef][\x80-\xbf]{2} |
[\xf0-\xf4][\x80-\xbf]{3}
- )+ |
- [\x80-\xc1\xf5-\xff] # invalid
- )/nx) { |c|
- c.size == 1 and raise GeneratorError, "invalid utf8 byte: '#{c}'"
- s = PSON::UTF8toUTF16.iconv(c).unpack('H*')[0]
- s.gsub!(/.{4}/n, '\\\\u\&')
+ )+)/nx) { |c|
+ PSON::UTF8toUTF16.iconv(c).unpack('H*')[0].gsub(/.{4}/n, '\\\\u\&')
}
- string
- rescue Iconv::Failure => e
- raise GeneratorError, "Caught #{e.class}: #{e}"
end
end
module_function :utf8_to_pson