![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a Oracle 10g Database Server on Suse Linux. I want to read records with a PHP script on a Linux Red Hat 9 Server (with Apache 2, PHP 5, and OCI8 functions). But SELECTs of text records that contains non-standard chars return an emtpy string. For non-standard chars I mean quotes or apostrophes like these: ' " " instead of: ' " What do I have do set in my web server? |
#3
| |||
| |||
|
|
Daniele escribió: I have a Oracle 10g Database Server on Suse Linux. I want to read records with a PHP script on a Linux Red Hat 9 Server (with Apache 2, PHP 5, and OCI8 functions). But SELECTs of text records that contains non-standard chars return an emtpy string. For non-standard chars I mean quotes or apostrophes like these: ' " " instead of: ' " What do I have do set in my web server? Quotes are quite standard... Are you dumping the results into HTML without proper escaping? If you actually meant non-English characters, find the "The Underground PHP and Oracle® Manual" manual and check chapter 15 (Globalization). You basically need to set an env variable in your Red Hat server. -- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://bits.demogracia.com -- Mi web de humor al baño María: http://www.demogracia.com -- |
#4
| |||
| |||
|
|
Sorry, I tried, but NG Server don't allow me to send in HTML. |
|
Anyway, quotes and apostrophes are the ones "automatically modified" by Word. |
|
I have a Oracle 10g Database Server on Suse Linux. I want to read records with a PHP script on a Linux Red Hat 9 Server (with Apache 2, PHP 5, and OCI8 functions). |
#5
| |||
| |||
|
|
I meant your application's HTML. The problem is before showhing data in HTML. |
#6
| |||
| |||
|
|
""Álvaro G. Vicario"" <alvaro.NOSPAMTHANX (AT) demogracia (DOT) com> ha scritto nel messaggio news:gnm4r9$imf$1 (AT) reader (DOT) motzarella.org... I meant your application's HTML. The problem is before showhing data in HTML. When I fetch rows with PHP functions, I get a null string if there are "smart quotes" in the content. The command: echo strlen($row['FIELD_NAME']); returns a 0 (or a number >0 when "smart quotes" are NOT present in the content of the field). But with ethereal I can see that the entire content of the field is received by the web server, so the problem should be in PHP (ver. 5.0.4) and/or Oracle libraries (instant client 10.1.0.4). I tried to upgrade PHP, OCI or both, but for some reasons the compilation fails. Daniele |
#7
| |||
| |||
|
|
What is the character set of your database? To contain those characters, it should be MSWIN1252 or one of the UTF's. What is the NLS_LANG setting of your PHP environment? "phpinfo();" should be able to tell you. |
#8
| |||
| |||
|
|
"Gerard H. Pille" <ghp (AT) skynet (DOT) be> ha scritto nel messaggio news:49a2fa7a$0$2858$ba620e4c (AT) news (DOT) skynet.be... What is the character set of your database? To contain those characters, it should be MSWIN1252 or one of the UTF's. What is the NLS_LANG setting of your PHP environment? "phpinfo();" should be able to tell you. Phpinfo: NLS_LANG: american_america.WE8MSWIN1252 NLS_NCHAR_CHARACTERSET: AL16UTF16 (SetEnv directive in httpd.conf) Oracle: SELECT * FROM NLS_DATABASE_PARAMETERS: PARAMETER VALUE ------------------------------ ---------------------------------------- NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CHARACTERSET WE8MSWIN1252 But now I found where is the problem. The field is a VARCHAR2 with size 254 (I cannot modify it, or NLS settings, since it's a third-party appliance). PHP returns an empty string ONLY IF the field is full (with all 254 characters) and contains "smart quotes". I have infact read (http://shiflett.org/blog/2005/oct/co...php#comment-13) that smart quotes (ASCII 0x91, 0x92, 0x93, 0x94) are converted from 1 byte to 3 bytes, and I think that the resulting string (>254 charachters) is bad read by PHP. (N.B.: The conversion function showed in the link doesn't resolve the problem, because the string is already null...). Daniele |
#9
| |||
| |||
|
|
The conversion from 1 to 3 bytes is because sql*net thinks the client uses a different characterset than the database, probably UTF. Do you specify a characterset in the oci_connect? $c = oci_connect("hr", "hrpwd", "localhost/XE", 'AL32UTF8'); Very strange thing. |
|
I found this in http://www.oracle.com/technology/tec...le-manual.pdf: Thank you for the manual, I'll read it. |
#10
| |||
| |||
|
|
The conversion from 1 to 3 bytes is because sql*net thinks the client uses a different characterset than the database, probably UTF. Do you specify a characterset in the oci_connect? $c = oci_connect("hr", "hrpwd", "localhost/XE", 'AL32UTF8'); Very strange thing. In my oci_connect I already had the characterset among parameters. |
![]() |
| Thread Tools | |
| Display Modes | |
| |