Solved

PHP/MySQL Export Data from Recordset; Foreign Characters

Posted on 2011-03-14
1
355 Views
Last Modified: 2012-05-11
PHP exports MySQL data to .csv files without problem except in the cae of accented characters. MySQL and PHP are set to utf8 and the data displays correctly on the page.

Is there any way we can improve the downloads?
0
Comment
Question by:smudgemouse
1 Comment
 
LVL 6

Accepted Solution

by:
brb6708 earned 500 total points
ID: 35128843
<?php

$dblink = new mysqli($servername,$user,$password,$dbname);

$res = $dblink->query("SET CHARACTER SET utf8");
$res = $dblink->query("SET NAMES utf8");
?>


after this you have made sure that mysql only talks utf8 to php. You can replace utf8 to any known character set compiled in MySQL if you like.

But I do not understand why you use php to convert MySQL tables to csv files. You can do it by a simple MySQL query in any character sert you like.


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question