Hi everyone,

There are three encodings you need to worry about: script encoding, 
output encoding, and runtime encoding.  By default, Quercus uses UTF-8 
for all three.  Script encoding is for when your scripts are in an 
encoding other than UTF-8.  It can be set in your web.xml file with:

<web-app xmlns="http://caucho.com/ns/resin";>
   <servlet-mapping url-pattern="*.php"

Output encoding is the charset used to display output to the browser.
You can set it in your script by:

ini_set("unicode.output_encoding", "MY_ENCODING");

   or in your web.xml:

<web-app xmlns="http://caucho.com/ns/resin";>
   <servlet-mapping url-pattern="*.php"

There is another encoding that you may be your stumbling block.  It is 
the unicode.runtime_encoding and it defaults to UTF-8.  It is a PHP 6 
directive that tells Quercus what encoding to assume a binary string is 
in when doing implicit conversions to Unicode.  You would set runtime 
encoding in the same way as you would for output encoding.

In PHP 6, there are two types of strings: Unicode and binary.  A binary 
string is a string where the data is binary, the encoding is unknown, or 
  the encoding is not Unicode (UTF-16).  If your database function is 
returning a binary string, then you probably need to set 
unicode.runtime_encoding.  If you are trying to print that binary string 
to the browser, then Quercus will convert your binary string to Unicode 
and then to your output-encoding.  If either your runtime encoding is 
wrong, then you would see garbage in your browser.

If you are still getting garbage after correctly setting your encoding 
configuration, then there is probably an issue with Quercus or one of 
its libraries.  If that is the case, then you should file a bug report 
at http://bugs.caucho.com and provide a simple test case.

MexIQ wrote:
> Thank you Markus, It is not matter of the file encoding because the
> problem also happened with my database results (using mysql 5). If I
> run mysql from console it display correctly the Japanese text, but
> when displaying it on the browser not.
> So, I tried other way around. I installed Tomcat, php-cgi and java-php
> bridge and now all my applications are running without any problem and
> without having to configure any file.

It appears to just work because PHP 5 is totally ignorant of encodings. 
   Everything is binary (byte-oriented).  When PHP 6 is released with 
its Unicode capability, I expect to see a lot of the same encoding 

> I'll continue testing caucho and quercus on other port because I think
> it can be useful on the future. So any configuration tip it would be
> welcome.
> Thank you!

I have posted this explanation up in the Getting Started Guide on 

-- Nam

resin-interest mailing list

Reply via email to