Solved

PHP/MySQL Export Data from Recordset; Foreign Characters

Posted on 2011-03-14
1
347 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
Comment Utility
<?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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now