Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP/MySQL Export Data from Recordset; Foreign Characters

Posted on 2011-03-14
1
Medium Priority
?
358 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
brb6708 earned 2000 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

Industry Leaders: 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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

704 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