fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-28 08:42 am

[dw-free] Feeds with ansi_x3.4-1968 encoding can't be parsed

[commit: http://hg.dwscoalition.org/dw-free/rev/eef597a174ee]

http://bugs.dwscoalition.org/show_bug.cgi?id=2737

ansi_x3.4-1968 is an alias for US-ASCII, which XML::Parser isn't aware of,
so just alias it directly.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/SynSuck.pm
--------------------------------------------------------------------------------
diff -r 3838df9b5861 -r eef597a174ee cgi-bin/LJ/SynSuck.pm
--- a/cgi-bin/LJ/SynSuck.pm	Mon Jun 28 15:48:38 2010 +0800
+++ b/cgi-bin/LJ/SynSuck.pm	Mon Jun 28 16:48:26 2010 +0800
@@ -157,6 +157,12 @@ sub process_content {
         # Assume it was Windows-1252.
         print "Invalid ISO-8859-1; assuming Windows-1252...\n" if $verbose;
         $content =~ s/encoding=([\"\'])(.+?)\1/encoding='windows-1252'/;
+    }
+
+    # ANOTHER hack: if a feed asks for ANSI_v3.4-1968 (ASCII),
+    # ignore it - just pretend it's something harmless like ISO-8859-1
+    if ( $encoding =~ /^ANSI_X3.4-1968$/i ) {
+        $content =~ s/encoding=([\"\'])(.+?)\1/encoding='us-ascii'/;
     }
 
     # parsing time...
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org