473,499 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP + Unicode

Hi all,

I have saved some data in a MySQL database as UTF-8 format. But when I
tried
to read the data using PHP, the webpage gave me all the "?"s. How to
read it
multilingual data correctly in PHP?
I believe there must be a way since I can see the words in UTF-8 in the

phpmyadmin interface. phpmyadmin is also coded in PHP and if it can do
it,
there must be a way to read multilingual data properly.

Anyone knows how to do it? Thanks a lot!

--Dan

Aug 26 '05 #1
3 1554
*** wi*******@gmail.com wrote/escribió (25 Aug 2005 22:27:20 -0700):
I have saved some data in a MySQL database as UTF-8 format. But when I
tried
to read the data using PHP, the webpage gave me all the "?"s. How to
read it
multilingual data correctly in PHP?


Have you set the appropriate headers to tell browser what charset it should
use to decode? It may not be the solution but it's a necessary step. Rather
than:

Content-Type: text/html; charset=ISO-8859-1

tell it's UTF-8.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 26 '05 #2
Yes, I set the appropriate headers to tell the browser it is UTF-8. But
it does not help!
Alvaro G Vicario wrote:

Have you set the appropriate headers to tell browser what charset it should
use to decode? It may not be the solution but it's a necessary step. Rather
than:

Content-Type: text/html; charset=ISO-8859-1

tell it's UTF-8.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--


Aug 26 '05 #3
Try this before you output anything:

mb_http_output("UTF-8");
ob_start("mb_output_handler");

It automagically converts to UTF-8. Other suggestion:
Have you set the Default-Charset in your httpd.conf? If I recall
correctly it overrides anything in your script if it is set.

AllOlli
Sep 3 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17590
by: Michael Weir | last post by:
I'm sure this is a very simple thing to do, once you know how to do it, but I am having no fun at all trying to write utf-8 strings to a unicode file. Does anyone have a couple of lines of code...
8
5250
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
8
3639
by: Francis Girard | last post by:
Hi, For the first time in my programmer life, I have to take care of character encoding. I have a question about the BOM marks. If I understand well, into the UTF-8 unicode binary...
48
4577
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at...
4
6035
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
2
2610
by: Neil Schemenauer | last post by:
python-dev@python.org.] The PEP has been rewritten based on a suggestion by Guido to change str() rather than adding a new built-in function. Based on my testing, I believe the idea is...
10
8009
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
6
6997
by: Jeff | last post by:
Hi - I'm setting up a streamreader in a VB.NET app to read a text file and display its contents in a multiline textbox. If I set it up with System.Text.Encoding.Unicode, it reads a unicode...
13
3260
by: Tomás | last post by:
Let's start off with: class Nation { public: virtual const char* GetName() const = 0; } class Norway : public Nation { public: virtual const char* GetName() const
24
8986
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.