[PHP-DEV] new iconv functions

2002-12-31 Thread Moriyoshi Koizumi
Hi,

I've just committed a patch which I mentioned in the previous mail.

http://news.php.net/article.php?group=php.devarticle=92027

But I'm not sure if the function naming really conforms to the standard. 
If it annoys you, please let me know.

Regards,
Moriyoshi


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] New iconv functions being introduced

2002-12-02 Thread Moriyoshi Koizumi
Hi,

I've implemented some string related functions that make use of iconv().
Following is the list of them.

=
- _php_iconv_appendl()
  Converts the given string in the way specified by a conversion
  descriptor and then appends it with smart_str_appendl().
  Note that the string being converted is not expected to be encoded with
  stateful encodings such as iso-2022-kr.

- _php_iconv_appendc()
  The single character version of _php_iconv_appendl().

- _php_iconv_strlen()
  Character-mapping aware version of strlen().
  Returns the actual count of characters in a string, not the length of  
  the string in bytes. See also the description of mb_strlen().

- _php_iconv_substr()
  Character-mapping aware version of substr().
  Offsets should be expressed as the nunber of the leading characters 
  counted from the beginning. See also the description of mb_substr.

- _php_iconv_strpos()
  Character-mapping aware version of strpos().
  Returns the position of the first occurrence of the needle that is 
  expressed in the manner of character count described so far.
  See also the description of mb_strpos().

- _php_iconv_mime_encode()
  Composes and returns a mime header from the given field name and the 
  value. The encoding scheme is defined in rfc2047.

- _php_iconv_mime_decode()
  Decodes the mime header and returns the result.
  This function may fail when the conversion is being performed between
  two incompatible character-mappings.

=
Userland functions:

proto int iconv_strlen(string str [, string charset]);

proto string iconv_substr(string str, int offset, int length
  [, string charset]);
proto string iconv_strpos(string haystack, string needle, int offset
  [, string charset]);
proto string iconv_strrpos(string haystack, string needle
  [, string charset]);
proto string iconv_mime_encode(string field_name, string field_value,
  string scheme, string out_charset [, string in_charset,
  int line_len, string lfchars]);
proto string iconv_mime_decode(string encoded_string [, string charset]);

=

If interested, you can fetch the patch at
http://www.voltex.jp/patches/iconv_functions-patch.diff.gz

But I'm not sure if these are really needed while mbstring offers the
 same facility. So it would rather depend on the result of discussion 
whether I commit this patch or not :)

Your comments will be greatly appreciated.

Moriyoshi



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php