in reply to How do I safely, portably extract one or more bytes from a string?
But I think the real question should be: Why don't you know what is in that string? If it can contain binary data and UTF-8 then you should know how it comes into your program. And there is the point you have work on.
For example: If you read the string from a file, you should know if it is a binary file (open it :bytes then) or a UTF-8 file (open it :utf8) or a EBCDIC file or Big5...
Or is it binary with embedded UTF-8 strings? Then open it :bytes and convert the extracted text pieces.
Note: Or aren't you working with UTF-8 at all? Then characters are bytes for you. No need to worry.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I safely, portably extract one or more bytes from a string?
by Anonymous Monk on Nov 29, 2003 at 05:32 UTC | |
by liz (Monsignor) on Nov 29, 2003 at 17:43 UTC | |
by Beechbone (Friar) on Nov 30, 2003 at 20:37 UTC |