[XOM-interest] Has anyone experience using tag Soup to read Windows files on a Linux system?

David Collier-Brown davec-b at rogers.com
Sun Feb 6 11:06:26 EST 2011


Thanks for the pointer, that solved the problem.

Nothing solves the underlying one, though. which is that I'm reading
Microsoft-produced dreck with Tag Soup, and the encoding is buried
several tags deep in a <meta http-equiv="Content-Type" 
content="text/html; charset=windows-1252"/> tag.  This breaks most sane
recognition schemes, so I have to specify it in the code (;-))

The solution for the real problem is to switch the company to using
InDesign or the like, and UTF-8.

--dave


Peter Taylor wrote:
> the xml declaration should have defined the encoding, but as a work-around try using this:
>
> http://download.oracle.com/javase/6/docs/api/java/io/InputStreamReader.html#InputStreamReader%28java.io.InputStream,%20java.lang.String%29
>
> to adapter the inputstream with a charset into a reader, then pass this reader to the InputSource.
>
>
> -----Original Message-----
> From: xom-interest-bounces at lists.ibiblio.org on behalf of David Collier-Brown
> Sent: Sun 06/02/2011 01:08
> To: XOM API for Processing XML with Java
> Cc: davecb at spamcop.net
> Subject: [SPAM(hdr)] - [XOM-interest] Has anyone experience using tag Soup to read Windows files on a Linux system?
>  
>   This is perhaps as much a tag soup question as an XOM one, but I'm
> trying to read a file created in a Windows character set and then copied
> to our production Linux system.
>
>   Has anyone experience in explicitly setting the input character set so
> that the sax parser, in this case tag soup, can interpret it properly?
> I've experimented with setting the encoding with an InputSource, but
> with no visible effect.
>
> --dave
>
>   


-- 
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net           |                      -- Mark Twain
(416) 223-8968




More information about the XOM-interest mailing list