Mike, > if I understand correctly, you can make a copy of > the the iconv_t and use that to do the lookahead.
No, you cannot copy an iconv_t. When you tie an iconv_t to a stream, the iconv_t can only go forward and never go backwards or restart at an earlier position (at least for stateful encodings). > The problem with the legacy input API w.r.t stateful encodings is the > 'unread-char' and 'unread-string' operations. Unreading stateful encodings > is difficult. (It could be done in our legacy ports by always keeping > a dynamically allocated pushback buffer encoded in UTF-32 or UTF-8 Yes, this is a possible technique. However, in some cases (e.g. parsing of HTTP requests) people want to switch from one input encoding to another. If you have already converted the input to Unicode and put something into the pushback buffer and _then_ try to switch to another encoding, it gets ugly. Bruno