vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   If and Else Statements don't work for Unicode? (https://vborg.vbsupport.ru/showthread.php?t=126634)

vietkieu_cz 09-14-2006 08:05 PM

If and Else Statements don't work for Unicode?
 
Hi everybody,
I've tried some PHP codes by http://www.w3schools.com/php/php_if_else.asp
I wrote a page in UTF-U (Unicode) and it shows a blank page
then I try in ISO-8859-1 then the page shows all.

=> Page in Unicode => is blank
PHP Code:

<html><head><title>C?ng nghe th?ng tin VN</title>
</head>
<body>
<?php
$nd
=$_GET['t'];
$noiquy "Đọc nội quy của VNIT!";
if (
$nd=="")
  echo 
"Trang chu VNIT";
elseif (
$nd=="noiquy")
  echo 
"$noiquy"
else
  echo 
"Error"
?>
</body>
</html>

-------------- and page wrote in none-unicod
PHP Code:

<html><head><title>Cong nghe thong tin VN</title>
</head>
<body>
<?php
$nd
=$_GET['t'];
$noiquy "Doc noi quy cua VNIT!";
if (
$nd=="")
  echo 
"Trang chu VNIT";
elseif (
$nd=="noiquy")
  echo 
"$noiquy"
else
  echo 
"Error"
?>
</body>
</html>

please help me how to write in Unicode ?
thank you and sorry for my bad English :surprised:

Chousho 09-15-2006 09:32 AM

Quote:

Originally Posted by vietkieu_cz
Hi everybody,
I've tried some PHP codes by http://www.w3schools.com/php/php_if_else.asp
I wrote a page in UTF-U (Unicode) and it shows a blank page
then I try in ISO-8859-1 then the page shows all.

=> Page in Unicode => is blank
PHP Code:

<html><head><title>C?ng nghe th?ng tin VN</title>
</head>
<body>
<?php
$nd
=$_GET['t'];
$noiquy "Đọc nội quy của VNIT!";
if (
$nd=="")
  echo 
"Trang chu VNIT";
elseif (
$nd=="noiquy")
  echo 
"$noiquy"
else
  echo 
"Error"
?>
</body>
</html>

-------------- and page wrote in none-unicod
PHP Code:

<html><head><title>Cong nghe thong tin VN</title>
</head>
<body>
<?php
$nd
=$_GET['t'];
$noiquy "Doc noi quy cua VNIT!";
if (
$nd=="")
  echo 
"Trang chu VNIT";
elseif (
$nd=="noiquy")
  echo 
"$noiquy"
else
  echo 
"Error"
?>
</body>
</html>

please help me how to write in Unicode ?
thank you and sorry for my bad English :surprised:

Your English is good, don't worry! What version of PHP are you using?
I just tried it out to see if the unicode text would appear. I changed it a bit so the variable would show up.

http://www.oishii-sushi.com/tiengviet.php
PHP Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>C?ng nghe th?ng tin VN</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$nd
=$_GET['t'];
$noiquy "Đọc nội quy của VNIT!";
if (
$nd!="")
  echo 
"Trang chu VNIT";
elseif (
$nd!="noiquy")
  echo 
"$noiquy"
else
  echo 
"Error"
?>
</body>
</html>


vietkieu_cz 09-15-2006 09:59 AM

OK thank you very much :) The page works fine.
I'm using PHP Version 4.3.11 (Localhost only)
ps: tiengviet.php => are you Vietnamese? :P

Chousho 09-15-2006 10:10 AM

Quote:

Originally Posted by vietkieu_cz
OK thank you very much :) The page works fine.
I'm using PHP Version 4.3.11 (Localhost only)
ps: tiengviet.php => are you Vietnamese? :P

Haha, no problem. I'm not Vietnamese, but I have friends who are. I would also like to learn the language, but it's been hard for me, haha.


All times are GMT. The time now is 11:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01149 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete