httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-2.0/src/lib/apr/include apr_iconv.h
Date Fri, 14 Jan 2000 23:56:31 GMT
On 14 Jan 2000 rbb@hyperreal.org wrote:
>...
>   void ap_codepage_open(ap_iconv_t **convset, const char *topage, 
>                            const char *frompage, ap_context_t *context); 
>   void ap_translate_codepage(ap_iconv_t *convset, const char *inbuf, 
>                                 ap_size_t inbytes_left, const char *outbuf,
>                                 ap_size_t outbytes_left);
>   /* The purpose of ap_translate char is to translate one character
>    * at a time.  This needs to be written carefully so that it works
>    * with double-byte character sets. 
>    */
>   void ap_translate_char(ap_iconv_t *convset, char inchar, char outchar);
>   void ap_codepage_close(ap_iconv_t *convset)

Ryan,

You'll need ap_status_t on (at least) the first three. Certainly on the
creation, but a codepage conversion *can* produce errors (for invalid byte
sequences).

Also note that the prototype for ap_translate_char() has "char outchar".
It won't be able to do its job :-). Looks like the same for
"outbytes_left"?

I know you're just starting on it, but it might be nice to provide a
couple examples for "topage" and "frompage" ... i.e. what is the format of
the string? It would also be nice to provide a registration function so
that modules can register a conversion(s). For example:
  ./configure --enable-module=shift_jis

And maybe it is obvious, but expand your comment about "written carefully"
to note that the ap_iconv_t would store state to manage this process. This
would imply an ap_iconv_t could not be shared for translation. It also
implies that you may want a way to reset the state (e.g. "I'm about to
parse a new string; reset your inside-multi-byte flags"), along with a way
to say "the string is done; did I end inside a multibyte sequence?" (which
is an error)

And last but not least... maybe include a variant that operates on files?
(or at least provide a utility that implements this version in terms of
ap_translate_codepage)  It would be nice to translate an input file
directly into an output socket.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message