how can i make a web page having both english and hindi character with php mysql

Reply

Join Date: Jul 2009
Posts: 5
Reputation: mahakaal is an unknown quantity at this point 
Solved Threads: 0
mahakaal's Avatar
mahakaal mahakaal is offline Offline
Newbie Poster

how can i make a web page having both english and hindi character with php mysql

 
0
  #1
21 Days Ago
How to handle UTF-8 characters in HTML, JavaScript, PHP and MySQL ...
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 433
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training
 
1
  #2
21 Days Ago
Hey.

HTML:
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf8">
  5. </head>
  6. <body />
  7. </html>

MySQL
  1. -- When creating a table:
  2. CREATE TABLE `myTable`(
  3. -- <insert fields>
  4. )DEFAULT CHARSET=utf8;
  5.  
  6. -- Before querying the database.
  7. -- Note, this is usually not needed, but can be.
  8. SET NAMES 'utf8';

And as to PHP and Javascript...
You usually don't have to worry much about the character encoding in either of those. Just make sure you create the code files themselves as UTF-8 (without BOM) and you should be fine.
PHP strings are basically just byte arrays, so they don't differentiate between charsets, unless you attempt to manipulate them using the string functions, in which case they are treated as ISO. (Unless the function offers the ability to specify a charset.)

However, if PHP is giving you trouble, you can use utf8_encode to convert ISO characters over to UTF-8.
Also, if you use htmlentities or htmlspecialchars, make sure you set the third parameter correctly.
Please do not ask for help in a PM. Use the forums.
And use [code] tags!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 151
Reputation: venkat0904 is an unknown quantity at this point 
Solved Threads: 15
venkat0904's Avatar
venkat0904 venkat0904 is online now Online
Junior Poster
 
0
  #3
21 Days Ago
nice info Atli... i guess it will prove helpful fr me someday

Originally Posted by Atli View Post
Hey.

HTML:
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf8">
  5. </head>
  6. <body />
  7. </html>

MySQL
  1. -- When creating a table:
  2. CREATE TABLE `myTable`(
  3. -- <insert fields>
  4. )DEFAULT CHARSET=utf8;
  5.  
  6. -- Before querying the database.
  7. -- Note, this is usually not needed, but can be.
  8. SET NAMES 'utf8';

And as to PHP and Javascript...
You usually don't have to worry much about the character encoding in either of those. Just make sure you create the code files themselves as UTF-8 (without BOM) and you should be fine.
PHP strings are basically just byte arrays, so they don't differentiate between charsets, unless you attempt to manipulate them using the string functions, in which case they are treated as ISO. (Unless the function offers the ability to specify a charset.)

However, if PHP is giving you trouble, you can use utf8_encode to convert ISO characters over to UTF-8.
Also, if you use htmlentities or htmlspecialchars, make sure you set the third parameter correctly.
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC