473,471 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP and MySQL umlauts communication

7 New Member
Dear Community,

I have a concern which I think I never had before - when I add data to my MySQL Database from PHP, the umlauts (ä,ö,ü) get encrypted.
This happens only when I do it via PHP.
I see the encrypted form when I log on to phpMyAdmin and when I visit the website.
When I edit the content via phpMyAdmin I can use the normal umlauts and they are both shown good (on the website and phpMyAdmin).

I tried several things to solve the problem, from adding to my mysql-class a query with SET NAMES 'UTF8' to using decode_utf8() function while retrieving data in mysql class.
I set charset in html and removed it - nothing changes.

My guess is that PHP is changing the umlauts in some way and sending the "wrong" data to MySQL Server.. is that right?

I don't want to store the data in a wrong format, and since I can store the data from within phpMyAdmin, it should be possible to send the data in the same charset via PHP right?

How can I solve this?

Best regards,

Matthias
Oct 24 '12 #1
4 3209
johny10151981
1,059 Top Contributor
I am not sure what your problem can be.
but after successful connection run this statement, it might solve your problem
Expand|Select|Wrap|Line Numbers
  1.  mysql_query("SET NAMES 'utf8'",conn);
Oct 25 '12 #2
Mat Son
7 New Member
Yeah unfortunately I already tried that but still, when I enter data via PHP in my database the umlauts get encrypted..
Oct 25 '12 #3
Mat Son
7 New Member
Okaay.. I got it by now.. I made a stupid mistake, my own files were not encoded as UTF-8.

http://sonsol.de/example/umlauts.php

I wrote this little file to check where the error occurs.. and in the end, when I checked both html and mysql charsets, all was fine - except the content that was added via my php file.
So I found out I have to encode the file as well, did that.. now everythings fine... thanks anyway ;-)
Oct 25 '12 #4
johny10151981
1,059 Top Contributor
Good then, but make sure your file is utf-8 format without BOM mark, otherwise it will be a problem for your browser
Oct 25 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Joerg Lehmann | last post by:
I am using Python 2.2.3 (Fedora Core 1). The problem is, that strings containing umlauts do not work as I would expect. Here is my example: >>> a = 'äöü' >>> b = '123' >>> print "%-5s...
5
by: F. GEIGER | last post by:
I'm on WinXP, Python 2.3. I don't have problems with umlauts (ä, ö, ü and their uppercase instances) in my wxPython-GUIs, when displayed as static texts. But when filling controls with text...
0
by: John Pedersen | last post by:
Hi, Since I have installed mysql 4.1 I am getting this error on trying to reach the db: java.sql.SQLException: Communication failure during handshake. Is there a server running on...
1
by: slzang | last post by:
hi: i got a very serious problem,i really dont know how can i fix it! it seems my mysqld died after ten hours. system redhat linux as 3+ apache 2.x+tomcat4.x+mysql4.0.20+jsp+...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: Nico Grubert | last post by:
Hi there, I wrote a short python script that sends an email using python's email module and I am using Python 2.3.5. The problem is, that umlauts are not displayed properly in some email...
6
jafarsalam
by: jafarsalam | last post by:
hi; I'm new to PHP and AJAX MySQL codes. I found a simple code for PHP and AJAX MySQL Database communication on : http://www.w3schools.com/php/php_ajax_database.asp I downloaded the code and...
7
by: bylum | last post by:
Servlet SQLException Communication link failure java howto i can't connect jsp and database(mysql). This is the exception: exception org.apache.jasper.JasperException:...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
5
by: xoise | last post by:
Warning: mysql_connect() : Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /webs/sites/monetized.com/includes/mysql_connect.inc.php on line 2 Lost...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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 ...
0
muto222
php
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.