From dfe22be5fff34349b5ca2e793919d11e4acb2c86 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sat, 17 May 2008 02:32:20 -0500 Subject: [PATCH] Minor tweak This is slightly better. --- lib/sanitize.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/sanitize.rb b/lib/sanitize.rb index 8d2e0595..00af8297 100644 --- a/lib/sanitize.rb +++ b/lib/sanitize.rb @@ -133,8 +133,7 @@ class String #expand NCRs to utf-8 pieces = self.split(/&#[xX]([a-fA-F0-9]+);/) 1.step(pieces.length-1, 2) {|i| pieces[i] = [pieces[i].hex].pack('U*')} - text = pieces.join - pieces = text.split(/&#(\d+);/) + pieces = pieces.join.split(/&#(\d+);/) 1.step(pieces.length-1, 2) {|i| pieces[i] = [pieces[i].to_i].pack('U*')} text = pieces.join #ensure the resulting string of bytes is valid utf-8