in reply to Re: Handling malformed UTF-16 data with PerlIO layer
in thread Handling malformed UTF-16 data with PerlIO layer
Why don't you fix the bad files instead of having your program handle them?
...mostly because I'd rather avoid having to get down to the encoding nitty-gritties, if there is some 'proper' way of doing it with Perl's built-in encoding support. For example, the ad-hoc approach you've shown would also replace valid surrogate pairs, which I'd rather keep, if possible (just in case). Sure, the regex could presumably be fixed to handle this (using lookahead), but this would be kind of reinventing the wheel... OTOH, it looks like the best workaround for the issue so far — So, thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Handling malformed UTF-16 data with PerlIO layer
by ikegami (Patriarch) on Oct 28, 2008 at 00:24 UTC | |
by almut (Canon) on Oct 28, 2008 at 01:02 UTC | |
by graff (Chancellor) on Oct 28, 2008 at 06:33 UTC | |
by almut (Canon) on Oct 28, 2008 at 20:12 UTC | |
by graff (Chancellor) on Oct 28, 2008 at 22:24 UTC | |
by ikegami (Patriarch) on Oct 28, 2008 at 10:13 UTC | |
by ikegami (Patriarch) on Oct 28, 2008 at 02:34 UTC |