diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-10-18 11:57:56 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2010-10-18 11:57:56 -0700 |
| commit | b1ef091d0209a59ac747568f83416e992db93ea8 (patch) | |
| tree | 8e361b6067834867ec07def13d7c8522dcc153b5 /lib/puppet/external | |
| parent | 9f593429b488a1d3f900757d28ab0432303bd469 (diff) | |
| parent | e3fc5b95d133aee1ae3dc188e6c47e88786dfc6e (diff) | |
| download | puppet-b1ef091d0209a59ac747568f83416e992db93ea8.tar.gz puppet-b1ef091d0209a59ac747568f83416e992db93ea8.tar.xz puppet-b1ef091d0209a59ac747568f83416e992db93ea8.zip | |
Merge commit '2.6.3rc1'
Diffstat (limited to 'lib/puppet/external')
| -rw-r--r-- | lib/puppet/external/pson/pure/generator.rb | 17 |
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 |
