Re: [Resin-interest] PHP and UTF-8

2007-03-13 Thread Anoop K Achuthan
Hi MexIQ ,
  I'm not sure about this solution. But you can try setting LANG 
environment variable
like , export LANG=ja_JP.utf8 and restarting resin.

-Anoop


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.
>
>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!
>
>On 3/12/07, Markus Ken Baron-Moriyama <[EMAIL PROTECTED]> wrote:
>  
>
>>Hi,
>>I tried out this configuration:
>>  >   servlet-class="com.caucho.quercus.servlet.QuercusServlet">
>>
>>  UTF-8
>>
>>  
>>
>>and the php:
>>>   $charset = "UTF-8";
>>   header("Content-Type: text/html; charset=".$charset);
>>   echo "";
>>   $var = utf8_encode("バリューパック"); //Japanese text
>>   echo utf8_decode($var);
>>   echo "";
>>?>
>>
>>and it works for me with the correct Japanese output.
>>I am using Resin 3.0.23 with JDK 1.5 on Win XP. Are you sure that your
>>utf8Test.php is really in UTF-8? As default, I think japanese files are
>>created with EUC-JP on linux, so maybe you will have to convert the file
>>first.
>>
>>Best regards,
>>markus
>>
>>
>>MexIQ MexIQ wrote:
>>
>>
>>>Maybe I'm doing something else wrong... I added at the default resin-web.xml:
>>>
>>>  
>>>ISO-8859-1
>>>  
>>>
>>>And I had the same results.
>>>
>>>My directory structure is:
>>>
>>>/WEB-INF/web.xml
>>>/utf8Test.php
>>>
>>>I need something else?
>>>
>>>I'm sorry to ask, but I have been looking on the wiki and the web and
>>>I don't find what I need. Do you know what part of the documentation I
>>>have to read?
>>>
>>>thank you.
>>>
>>>On 3/11/07, MexIQ MexIQ <[EMAIL PROTECTED]> wrote:
>>>
>>>  
>>>
Thank you Sun,

I have in my WEB-INF/web.xml
ISO-8859-1

I will try to add it to resin-web.xml and see what happen...

I will reply...

On 3/11/07, sun baoming <[EMAIL PROTECTED]> wrote:



>official document says in your web.xml or resin-web.xml :
>
>
>http://caucho.com/ns/resin";>
> 
> servlet-class="com.caucho.quercus.servlet.QuercusServlet">
> 
> 
>
>ISO-8859-1
> 
>
> 
>
>give it a try.
>
>when i used  this with chinese encoding ,maybe the same as your problem, in
>my experience it never worked .
>
>2007/3/10, MexIQ MexIQ < [EMAIL PROTECTED] >:
>
>  
>
>>(Sorry to send it again, but I used other email account and I was not
>>sure if it was received).
>>
>>Hello everyone, I was always expecting to have JAVA and PHP together
>>(I develop in both languages and I wanted a simple and fast way to run
>>my applications in just one server and one port and taking advantage
>>of my java codes). I wanted to give caucho a look and I tried to run a
>>small system buy I'm having some problems trying to get some special
>>characters to display.
>>
>>I made this test:
>>
>>>   $charset = "UTF-8";
>>   header("Content-Type: text/html; charset=".$charset);
>>   echo "";
>>   $var = utf8_encode("バリューパック"); //Japanese text
>>   echo utf8_decode($var);
>>   echo "";
>>?>
>>
>>I think it have to display it as the original text. But it just
>>display the UTF-8 charset on the screen:
>>
>>バリューãƒ'ック
>>
>>If I comment the line: header("Content-Type: text/html;
>>
>>
>>
>charset=".$charset);
>
>  
>
>>and manually I select "UTF-8" encoding, the correct (original) text is
>>displayed.
>>
>>I'm using firefox in linux, but I tested also with I.E. and firefox
>>(windows) from other computer.
>>
>>Maybe I have something wrong in my configuration.
>>It is not just Japanese, I also tested with latin characters and was
>>the same thing.
>>
>>By the way, do you know if Quercus will add the Multi-byte functions?
>>
>>And... sure! I would like to help Quercus to grow...
>>___
>>resin-interest mailing list
>>resin-interest@caucho.com
>>
>>
>>
>>
>http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>___
>resin-interest mailing list
>resin-interest@caucho.com
>http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>
>
>  
>
>>>___
>>>resin-

Re: [Resin-interest] PHP and UTF-8

2007-03-13 Thread Nam
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:

http://caucho.com/ns/resin";>
   
 
   MY_ENCODING
 
   



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:

http://caucho.com/ns/resin";>
   
 
   
 MY_ENCODING
 
   



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 
headaches.

> 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 
http://quercus.caucho.com.

Cheers!
-- Nam


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] PHP and UTF-8

2007-03-12 Thread MexIQ
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.

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!

On 3/12/07, Markus Ken Baron-Moriyama <[EMAIL PROTECTED]> wrote:
> Hi,
> I tried out this configuration:
>   servlet-class="com.caucho.quercus.servlet.QuercusServlet">
> 
>   UTF-8
> 
>   
>
> and the php:
> $charset = "UTF-8";
>header("Content-Type: text/html; charset=".$charset);
>echo "";
>$var = utf8_encode("バリューパック"); //Japanese text
>echo utf8_decode($var);
>echo "";
> ?>
>
> and it works for me with the correct Japanese output.
> I am using Resin 3.0.23 with JDK 1.5 on Win XP. Are you sure that your
> utf8Test.php is really in UTF-8? As default, I think japanese files are
> created with EUC-JP on linux, so maybe you will have to convert the file
> first.
>
> Best regards,
> markus
>
>
> MexIQ MexIQ wrote:
> > Maybe I'm doing something else wrong... I added at the default 
> > resin-web.xml:
> >
> >   
> > ISO-8859-1
> >   
> >
> > And I had the same results.
> >
> > My directory structure is:
> >
> > /WEB-INF/web.xml
> > /utf8Test.php
> >
> > I need something else?
> >
> > I'm sorry to ask, but I have been looking on the wiki and the web and
> > I don't find what I need. Do you know what part of the documentation I
> > have to read?
> >
> > thank you.
> >
> > On 3/11/07, MexIQ MexIQ <[EMAIL PROTECTED]> wrote:
> >
> >> Thank you Sun,
> >>
> >> I have in my WEB-INF/web.xml
> >> ISO-8859-1
> >>
> >> I will try to add it to resin-web.xml and see what happen...
> >>
> >> I will reply...
> >>
> >> On 3/11/07, sun baoming <[EMAIL PROTECTED]> wrote:
> >>
> >>> official document says in your web.xml or resin-web.xml :
> >>>
> >>>
> >>> http://caucho.com/ns/resin";>
> >>>   >>>
> >>>  servlet-class="com.caucho.quercus.servlet.QuercusServlet">
> >>>  
> >>>  
> >>>
> >>> ISO-8859-1
> >>>  
> >>>
> >>>  
> >>> 
> >>> give it a try.
> >>>
> >>> when i used  this with chinese encoding ,maybe the same as your problem, 
> >>> in
> >>> my experience it never worked .
> >>>
> >>> 2007/3/10, MexIQ MexIQ < [EMAIL PROTECTED] >:
> >>>
>  (Sorry to send it again, but I used other email account and I was not
>  sure if it was received).
> 
>  Hello everyone, I was always expecting to have JAVA and PHP together
>  (I develop in both languages and I wanted a simple and fast way to run
>  my applications in just one server and one port and taking advantage
>  of my java codes). I wanted to give caucho a look and I tried to run a
>  small system buy I'm having some problems trying to get some special
>  characters to display.
> 
>  I made this test:
> 
>   $charset = "UTF-8";
> header("Content-Type: text/html; charset=".$charset);
> echo "";
> $var = utf8_encode("バリューパック"); //Japanese text
> echo utf8_decode($var);
> echo "";
>  ?>
> 
>  I think it have to display it as the original text. But it just
>  display the UTF-8 charset on the screen:
> 
>  バリューãƒ'ック
> 
>  If I comment the line: header("Content-Type: text/html;
> 
> >>> charset=".$charset);
> >>>
>  and manually I select "UTF-8" encoding, the correct (original) text is
>  displayed.
> 
>  I'm using firefox in linux, but I tested also with I.E. and firefox
>  (windows) from other computer.
> 
>  Maybe I have something wrong in my configuration.
>  It is not just Japanese, I also tested with latin characters and was
>  the same thing.
> 
>  By the way, do you know if Quercus will add the Multi-byte functions?
> 
>  And... sure! I would like to help Quercus to grow...
>  ___
>  resin-interest mailing list
>  resin-interest@caucho.com
> 
> 
> >>> http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>>
> >>> ___
> >>> resin-interest mailing list
> >>> resin-interest@caucho.com
> >>> http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>>
> >>>
> >>>
> > ___
> > resin-interest mailing list
> > resin-interest@caucho.com
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
> >
>
> --
> --
> Dipl.-Ing. Markus Ken Baron-Moriyama <[EMAIL PROTECTED]>
> Director of Global IT Relations and Re

Re: [Resin-interest] PHP and UTF-8

2007-03-12 Thread Markus Ken Baron-Moriyama
Hi,
I tried out this configuration:
  

  UTF-8

  

and the php:
";
   $var = utf8_encode("バリューパック"); //Japanese text
   echo utf8_decode($var);
   echo "";
?>

and it works for me with the correct Japanese output.
I am using Resin 3.0.23 with JDK 1.5 on Win XP. Are you sure that your 
utf8Test.php is really in UTF-8? As default, I think japanese files are 
created with EUC-JP on linux, so maybe you will have to convert the file 
first.

Best regards,
markus


MexIQ MexIQ wrote:
> Maybe I'm doing something else wrong... I added at the default resin-web.xml:
>
>   
> ISO-8859-1
>   
>
> And I had the same results.
>
> My directory structure is:
>
> /WEB-INF/web.xml
> /utf8Test.php
>
> I need something else?
>
> I'm sorry to ask, but I have been looking on the wiki and the web and
> I don't find what I need. Do you know what part of the documentation I
> have to read?
>
> thank you.
>
> On 3/11/07, MexIQ MexIQ <[EMAIL PROTECTED]> wrote:
>   
>> Thank you Sun,
>>
>> I have in my WEB-INF/web.xml
>> ISO-8859-1
>>
>> I will try to add it to resin-web.xml and see what happen...
>>
>> I will reply...
>>
>> On 3/11/07, sun baoming <[EMAIL PROTECTED]> wrote:
>> 
>>> official document says in your web.xml or resin-web.xml :
>>>
>>>
>>> http://caucho.com/ns/resin";>
>>>  >>
>>>  servlet-class="com.caucho.quercus.servlet.QuercusServlet">
>>>  
>>>  
>>>
>>> ISO-8859-1
>>>  
>>>
>>>  
>>> 
>>> give it a try.
>>>
>>> when i used  this with chinese encoding ,maybe the same as your problem, in
>>> my experience it never worked .
>>>
>>> 2007/3/10, MexIQ MexIQ < [EMAIL PROTECTED] >:
>>>   
 (Sorry to send it again, but I used other email account and I was not
 sure if it was received).

 Hello everyone, I was always expecting to have JAVA and PHP together
 (I develop in both languages and I wanted a simple and fast way to run
 my applications in just one server and one port and taking advantage
 of my java codes). I wanted to give caucho a look and I tried to run a
 small system buy I'm having some problems trying to get some special
 characters to display.

 I made this test:

 >>>$charset = "UTF-8";
header("Content-Type: text/html; charset=".$charset);
echo "";
$var = utf8_encode("バリューパック"); //Japanese text
echo utf8_decode($var);
echo "";
 ?>

 I think it have to display it as the original text. But it just
 display the UTF-8 charset on the screen:

 バリューãƒ'ック

 If I comment the line: header("Content-Type: text/html;
 
>>> charset=".$charset);
>>>   
 and manually I select "UTF-8" encoding, the correct (original) text is
 displayed.

 I'm using firefox in linux, but I tested also with I.E. and firefox
 (windows) from other computer.

 Maybe I have something wrong in my configuration.
 It is not just Japanese, I also tested with latin characters and was
 the same thing.

 By the way, do you know if Quercus will add the Multi-byte functions?

 And... sure! I would like to help Quercus to grow...
 ___
 resin-interest mailing list
 resin-interest@caucho.com

 
>>> http://maillist.caucho.com/mailman/listinfo/resin-interest
>>>   
>>> ___
>>> resin-interest mailing list
>>> resin-interest@caucho.com
>>> http://maillist.caucho.com/mailman/listinfo/resin-interest
>>>
>>>
>>>   
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>   

-- 
--
Dipl.-Ing. Markus Ken Baron-Moriyama <[EMAIL PROTECTED]>
Director of Global IT Relations and Research
Co-Founder

Wazap AG
Karl-Liebknecht-Str. 5
10178 Berlin
Germany

Tel:  +49 30 278744 2241
Fax:  +49 30 278744 29

URL: http://wazap.com/

Wazap Aktiengesellschaft
HRB 103534 B
Sitz der Gesellschaft: Berlin
Amtsgericht:Berlin-Charlottenburg
Vorstand:   Andreas Ruehrig (Vors.), Timo Meyer, Alexander Piutti, Philip 
Gienandt
Aufsichtsrat:   Martin Sinner (Vors.), Frank Bo"hnke, Florian Seubert



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] PHP and UTF-8

2007-03-10 Thread MexIQ MexIQ
Maybe I'm doing something else wrong... I added at the default resin-web.xml:

  
ISO-8859-1
  

And I had the same results.

My directory structure is:

/WEB-INF/web.xml
/utf8Test.php

I need something else?

I'm sorry to ask, but I have been looking on the wiki and the web and
I don't find what I need. Do you know what part of the documentation I
have to read?

thank you.

On 3/11/07, MexIQ MexIQ <[EMAIL PROTECTED]> wrote:
> Thank you Sun,
>
> I have in my WEB-INF/web.xml
> ISO-8859-1
>
> I will try to add it to resin-web.xml and see what happen...
>
> I will reply...
>
> On 3/11/07, sun baoming <[EMAIL PROTECTED]> wrote:
> > official document says in your web.xml or resin-web.xml :
> >
> >
> > http://caucho.com/ns/resin";>
> >   >
> >  servlet-class="com.caucho.quercus.servlet.QuercusServlet">
> >  
> >  
> >
> > ISO-8859-1
> >  
> >
> >  
> > 
> > give it a try.
> >
> > when i used  this with chinese encoding ,maybe the same as your problem, in
> > my experience it never worked .
> >
> > 2007/3/10, MexIQ MexIQ < [EMAIL PROTECTED] >:
> > >
> > > (Sorry to send it again, but I used other email account and I was not
> > > sure if it was received).
> > >
> > > Hello everyone, I was always expecting to have JAVA and PHP together
> > > (I develop in both languages and I wanted a simple and fast way to run
> > > my applications in just one server and one port and taking advantage
> > > of my java codes). I wanted to give caucho a look and I tried to run a
> > > small system buy I'm having some problems trying to get some special
> > > characters to display.
> > >
> > > I made this test:
> > >
> > >  > >$charset = "UTF-8";
> > >header("Content-Type: text/html; charset=".$charset);
> > >echo "";
> > >$var = utf8_encode("バリューパック"); //Japanese text
> > >echo utf8_decode($var);
> > >echo "";
> > > ?>
> > >
> > > I think it have to display it as the original text. But it just
> > > display the UTF-8 charset on the screen:
> > >
> > > バリューãƒ'ック
> > >
> > > If I comment the line: header("Content-Type: text/html;
> > charset=".$charset);
> > > and manually I select "UTF-8" encoding, the correct (original) text is
> > > displayed.
> > >
> > > I'm using firefox in linux, but I tested also with I.E. and firefox
> > > (windows) from other computer.
> > >
> > > Maybe I have something wrong in my configuration.
> > > It is not just Japanese, I also tested with latin characters and was
> > > the same thing.
> > >
> > > By the way, do you know if Quercus will add the Multi-byte functions?
> > >
> > > And... sure! I would like to help Quercus to grow...
> > > ___
> > > resin-interest mailing list
> > > resin-interest@caucho.com
> > >
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
> > >
> >
> >
> > ___
> > resin-interest mailing list
> > resin-interest@caucho.com
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
> >
> >
>
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] PHP and UTF-8

2007-03-10 Thread MexIQ MexIQ
Thank you Sun,

I have in my WEB-INF/web.xml
ISO-8859-1

I will try to add it to resin-web.xml and see what happen...

I will reply...

On 3/11/07, sun baoming <[EMAIL PROTECTED]> wrote:
> official document says in your web.xml or resin-web.xml :
>
>
> http://caucho.com/ns/resin";>
>  
>  servlet-class="com.caucho.quercus.servlet.QuercusServlet">
>  
>  
>
> ISO-8859-1
>  
>
>  
> 
> give it a try.
>
> when i used  this with chinese encoding ,maybe the same as your problem, in
> my experience it never worked .
>
> 2007/3/10, MexIQ MexIQ < [EMAIL PROTECTED] >:
> >
> > (Sorry to send it again, but I used other email account and I was not
> > sure if it was received).
> >
> > Hello everyone, I was always expecting to have JAVA and PHP together
> > (I develop in both languages and I wanted a simple and fast way to run
> > my applications in just one server and one port and taking advantage
> > of my java codes). I wanted to give caucho a look and I tried to run a
> > small system buy I'm having some problems trying to get some special
> > characters to display.
> >
> > I made this test:
> >
> >  >$charset = "UTF-8";
> >header("Content-Type: text/html; charset=".$charset);
> >echo "";
> >$var = utf8_encode("バリューパック"); //Japanese text
> >echo utf8_decode($var);
> >echo "";
> > ?>
> >
> > I think it have to display it as the original text. But it just
> > display the UTF-8 charset on the screen:
> >
> > バリューãƒ'ック
> >
> > If I comment the line: header("Content-Type: text/html;
> charset=".$charset);
> > and manually I select "UTF-8" encoding, the correct (original) text is
> > displayed.
> >
> > I'm using firefox in linux, but I tested also with I.E. and firefox
> > (windows) from other computer.
> >
> > Maybe I have something wrong in my configuration.
> > It is not just Japanese, I also tested with latin characters and was
> > the same thing.
> >
> > By the way, do you know if Quercus will add the Multi-byte functions?
> >
> > And... sure! I would like to help Quercus to grow...
> > ___
> > resin-interest mailing list
> > resin-interest@caucho.com
> >
> http://maillist.caucho.com/mailman/listinfo/resin-interest
> >
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] PHP and UTF-8

2007-03-10 Thread sun baoming

official document says in your web.xml or resin-web.xml :


http://caucho.com/ns/resin";>
 
   
 
ISO-8859-1
   
 


give it a try.

when i used  this with chinese encoding ,maybe the same as your problem, in
my experience it never worked .

2007/3/10, MexIQ MexIQ <[EMAIL PROTECTED] >:


(Sorry to send it again, but I used other email account and I was not
sure if it was received).

Hello everyone, I was always expecting to have JAVA and PHP together
(I develop in both languages and I wanted a simple and fast way to run
my applications in just one server and one port and taking advantage
of my java codes). I wanted to give caucho a look and I tried to run a
small system buy I'm having some problems trying to get some special
characters to display.

I made this test:

";
   $var = utf8_encode("バリューパック"); //Japanese text
   echo utf8_decode($var);
   echo "";
?>

I think it have to display it as the original text. But it just
display the UTF-8 charset on the screen:

バリューãƒ'ック

If I comment the line: header("Content-Type: text/html;
charset=".$charset);
and manually I select "UTF-8" encoding, the correct (original) text is
displayed.

I'm using firefox in linux, but I tested also with I.E. and firefox
(windows) from other computer.

Maybe I have something wrong in my configuration.
It is not just Japanese, I also tested with latin characters and was
the same thing.

By the way, do you know if Quercus will add the Multi-byte functions?

And... sure! I would like to help Quercus to grow...
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest