Hi Everyone,
I have been trying to build a website that has multilingual support
using the LAMP setup. I have created tables that store language
information and correlate different strings ids with languages. The
strings are all VARCHAR with unicode (utf8) encoding.
I have tried all the ways that I could think of and I have checked
every website to no avail. What I am trying to do is simply open a
connection to the database (using mysqli) and query the tables for one
unicode string entry. Then I call fetch_object on the result and print
it to an HTML document. This fails with me. The characters I see are
not unicode but either ??????? or some weird character. Aparently the
encoding turns out to be ISO-8859-1.
I have done the following:
1. Create the entries in the MySQL tables as unicode in InnoDB tables.
Unicode text shows up properly in phpmyadmin.
2. Query correctly to the best of my knowledge using mysqli.
3. Add the proper header encoding to the http header and add this meta
tag to the html:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Everything I have read says that this should work even though PHP is
notorious for unicode support. What I have been able to narrow down the
problem to is that the string that I get back from the database is
latin encoding. I know it is unicode from MySQL (phpmyadmin), so I
assume the problem lies in the mysqli_query function call or with the
fetch_object call.
Please help, I have been stuck on this for days now.
Thanks
Roland 3 2274
Maybe this will help:
mysqli_set_charset('utf8'); ro*********@gmail.com wrote:
Hi Everyone,
I have been trying to build a website that has multilingual support
using the LAMP setup. I have created tables that store language
information and correlate different strings ids with languages. The
strings are all VARCHAR with unicode (utf8) encoding.
I have tried all the ways that I could think of and I have checked
every website to no avail. What I am trying to do is simply open a
connection to the database (using mysqli) and query the tables for one
unicode string entry. Then I call fetch_object on the result and print
it to an HTML document. This fails with me. The characters I see are
not unicode but either ??????? or some weird character. Aparently the
encoding turns out to be ISO-8859-1.
I have done the following:
1. Create the entries in the MySQL tables as unicode in InnoDB tables.
Unicode text shows up properly in phpmyadmin.
2. Query correctly to the best of my knowledge using mysqli.
3. Add the proper header encoding to the http header and add this meta
tag to the html:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Everything I have read says that this should work even though PHP is
notorious for unicode support. What I have been able to narrow down the
problem to is that the string that I get back from the database is
latin encoding. I know it is unicode from MySQL (phpmyadmin), so I
assume the problem lies in the mysqli_query function call or with the
fetch_object call.
Please help, I have been stuck on this for days now.
Thanks
Roland
Yes thanks!!! That did it! Wow, 4 days of debugging for this!
Thanks a lot.
However, i have a problem with my versions. I am running locally on
WAMP 1.6.3 and the function seems to be missing. However on my hosting
server, though they are using an older MySQL database vesion (4.1) with
PHP5, there are no problems. That's how I know it works. All that
remains is to fix this locally for WAMP.
Thanks.
Roland
If you don't have that function, you could try sending this directly to
mysql:
SET NAMES UTF8 ro*********@gmail.com wrote:
Yes thanks!!! That did it! Wow, 4 days of debugging for this!
Thanks a lot.
However, i have a problem with my versions. I am running locally on
WAMP 1.6.3 and the function seems to be missing. However on my hosting
server, though they are using an older MySQL database vesion (4.1) with
PHP5, there are no problems. That's how I know it works. All that
remains is to fix this locally for WAMP.
Thanks.
Roland
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Aditya Ivaturi |
last post by:
We have a CMS which is written is based on php & mysql. Recently we received
a request to support multiple languages so that sites in that particular
laguage can be created. I did some search on...
|
by: apchar |
last post by:
I am trying to use php as a kind of servlet to act as a middle man
between a java applet and mysql. I know java has jdbc but it's flakey
and painful. php access to mysql is much nicer. So I have:...
|
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,...
|
by: Vincent Bouret |
last post by:
Hi,
I have read that Unicode (UTF-8) was not enabled by default in the
mysql-4.1.0-alpha binaries. How can I enable it? What should I change in the
code to do so?
Thanks
Vincent
|
by: Robert Mazur |
last post by:
Solaris 9 - sparc 64bit
MySQL 5.0 alpha (installed using binary from MySQL)
---------------------------------
Has anyone expereinced this? The client will launch locally and
process SQL...
|
by: jrs_14618 |
last post by:
Hello All,
This post is essentially a reply a previous post/thread
here on this mailing.database.myodbc group titled:
MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode
I was...
|
by: erikcw |
last post by:
Hi,
I'm trying to insert some data from an XML file into MySQL. However,
while importing one of the files, I got this error:
Traceback (most recent call last):
File "wa.py", line 304, in ?...
|
by: macca |
last post by:
Hi,
What should I be using for general MySQL database access? I've been
using the traditional mysql extension for ages, but I'm trying to
update my style to a more OOP paradigm.
I've used...
|
by: marexposed |
last post by:
I've got this error (see the path in last line)
db=MySQLdb.connect(host='localhost',use_unicode = True, charset = "Windows-1251",user='root',passwd='12',db='articulos')
File...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |