in reply to Encoding of DBI PostgreSQL output
I have a similar problem and am driving myself crazy with it.
I need to convert a string in Perl's internal format and which is guaranteed to contain no characters higher than \x{017F} (i.e. it's ASCII, plus extended Latin A) to "hex entities" e.g. ſ to be sent to a browser (don't suggest changing browser or changing the encoding layer of the CGI talking to the browser - only the hex entity solution will work in my particular case!).
I got so fed up playing with encode/decode, pack/unpack, et al, that I just did it as a clumsy mapping table (deadline was pressing) e.g.
$string =~ s/\x{017f}/ſ/g (for every char from \x00C0 to \x017F)
which has the merits of (a) working and (b) being simple enough for a simple soul such as myself to understand. However, there has to be a decent (and faster, more elegant, etc) solution to this. Sounds like one for the fans of "map" ...
AndyH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Encoding of DBI PostgreSQL output
by Kjetil (Sexton) on May 21, 2003 at 15:51 UTC | |
by graff (Chancellor) on May 21, 2003 at 16:40 UTC | |
by AndyH (Sexton) on May 22, 2003 at 13:38 UTC |