4

One site was moved to another server where is installed Solaris and other iconv settings. Now, when I validate anything with "StringLength" function from Zend Framework my scripts fail with this error:

Notice: iconv_strlen() [function.iconv-strlen]: Wrong charset, conversion from `UTF-8' to `UCS-4LE' is not allowed in /usr_files/phplibs/library/Zend/Validate/StringLength.php on line 213

As I understood, server does know about "UCS-4LE" and it is main problem.

Server administrator answered that he could resolve this problem. Do you have any ideas how I can setup ZF at this server?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
kubum
  • 469
  • 2
  • 13

2 Answers2

1

the iconv library was expecting a string encoded in 'UCS-4LE', but received one that it detected as 'UTF-8'. You probably have a different default encoding on the new server. Try passing the third parameter to the constructor (as 'utf-8').

soulmerge
  • 73,842
  • 19
  • 118
  • 155
  • I have tryied: mb_internal_encoding("UTF-8"); As well, iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "UTF-8"); It doesnt work – kubum Oct 21 '09 at 17:45
0

Although an old topic, this one came up for me today while moving to a new server running xampp (Linux Suse, PHP 5.3.5, Zend Framework 1.11.10) . I reproduced the above error with the following test script:

<?php
echo iconv_strlen("hello");
?>

both on the command line and in browser. After some troubleshooting, I discovered that the following "solved" the immediate problem one of two ways:

<?php
echo iconv_strlen("hello", 'utf-8');
?>

or

<?php
iconv_set_encoding("internal_encoding", "UTF-8");
echo iconv_strlen("hello");
?>

however adding the iconv_set_encoding in ZF did not work.

Changing php.ini to make the changes permanent did work for ZF

[iconv]
iconv.input_encoding = ISO-8859-1
iconv.internal_encoding = UTF-8
iconv.output_encoding = ISO-8859-1

However the original reason why iconv acts up on the new server is beyond me.

mogoman
  • 2,286
  • 24
  • 28