On Fri, May 6, 2022 at 3:07 AM 'Dan Kortschak' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> On Fri, 2022-05-06 at 11:22 +0200, Diego Joss wrote:
> > Does this work for you?
> >
> > https://go.dev/play/p/xLRawVhcRtF
> >
>
> Thanks. No, the documents are in UTF-16, and the procinst will be too.
> So it looks more like this https://go.dev/play/p/4IcXNI3yd2M. If I pull
> the proc inst out of the UTF-16, then I can get it to work;
> https://go.dev/play/p/kHwkVWtxbNO. But this leads to the issue where at
> that point I could just decode the whole message and pass it through.
> So I don't really see the point of using CharsetReader (at least not
> with UTF-16).

Yeah, that's not the kind of thing that CharsetReader can help with.
You'll need a plain io.Reader that converts from UTF-16 to UTF-8.

CharsetReader only works if the character set name is available in
plain ASCII in the first XML definitions, but the data doesn't use
UTF-8.  It can be used with the kinds of encodings found in the
subdirectories of https://pkg.go.dev/golang.org/x/text/encoding.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWUsmnRpC_a_HausGTAasgcT1862F%3Dcae04cs%3DTP2uRVA%40mail.gmail.com.

Reply via email to