Re: cvs: php-src /sapi/cli php_cli_readline.c
| From: | Andrei Zmievski | Date: | Mon, 15 Aug 2005 03:11:14 +0000 |
| Subject: | Re: cvs: php-src /sapi/cli php_cli_readline.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-33387@lists.php.net to get a copy of this message | ||
On Aug 14, 2005, at 6:09 AM, Johannes Schlüter wrote:
I would recommend using u_strcpy() for copying Unicode strings around.+ if (UG(unicode)) { + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR;++ len = u_strlen((UChar *)retval); + zend_convert_from_unicode(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)retval, len, &status);++ retval = malloc(tmp_len + 2); + retval[0] = '$'; + strcpy(&retval[1], tmp);
+Same here, you can't rely on strdup() because it'll stop at the first NULL byte, and Unicode strings have plenty of them. -Andrei+ if (UG(unicode)) { + char *tmp; + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR;++ len = u_strlen((UChar *)func->common.function_name); + zend_convert_from_unicode(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)func-common.function_name, len, &status);++ retval = strdup(tmp);