PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > CSV fgetcsv() import removes special chars link â
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
CSV fgetcsv() import removes special chars link â

Réponse
 
LinkBack Outils de la discussion
Vieux 23/04/2008, 12h55   #1
matech
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut CSV fgetcsv() import removes special chars link â

how can I import CSV/TXT files without PHP removing special
characters?
I need to import CSV files to Mysql with lots of different characters.

for example: the original data is "SA-â-Gal Staining" and the import
data is: "SA-²-Gal Staining"

another example: "50 ìL "
converted to: "50 1/4g"

Thanks.

  Réponse avec citation
Vieux 23/04/2008, 14h36   #2
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: CSV fgetcsv() import removes special chars linkâ

On Wed, 23 Apr 2008 04:55:57 -0700 (PDT), matech wrote:
> how can I import CSV/TXT files without PHP removing special
> characters?
> I need to import CSV files to Mysql with lots of different characters.
>
> for example: the original data is "SA-â-Gal Staining" and the import
> data is: "SA-²-Gal Staining"
>
> another example: "50 ìL "
> converted to: "50 1/4g"


First, discover what encoding the csv file is in.

--
97. My dungeon cells will not be furnished with objects that contain reflective
surfaces or anything that can be unravelled.
--Peter Anspach's list of things to do as an Evil Overlord
  Réponse avec citation
Vieux 24/04/2008, 10h03   #3
matech
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: CSV fgetcsv() import removes special chars link â

On 23 Apr, 14:36, "Peter H. Coffin" <hell...@ninehells.com> wrote:
> On Wed, 23 Apr 2008 04:55:57 -0700 (PDT), matech wrote:
> > how can I import CSV/TXT files without PHP removing special
> > characters?
> > I need to import CSV files to Mysql with lots of different characters.

>
> > for example: the original data is "SA-â-Gal Staining" and the import
> > data is: "SA-² -Gal Staining"

>
> > another example: "50 ìL "
> > converted to: "50 1/4 g"

>
> First, discover what encoding the csv file is in.
>
> --
> 97. My dungeon cells will not be furnished with objects that contain reflective
> surfaces or anything that can be unravelled.
> --Peter Anspach's list of things to do as an Evil Overlord


the file is saved as unicode (UTF-8) CSV
  Réponse avec citation
Vieux 24/04/2008, 10h07   #4
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: CSV fgetcsv() import removes special chars link â

On Thu, 24 Apr 2008 11:03:43 +0200, matech <robert.mateer@hotmail.co.uk>
wrote:

> On 23 Apr, 14:36, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>> On Wed, 23 Apr 2008 04:55:57 -0700 (PDT), matech wrote:
>> > how can I import CSV/TXT files without PHP removing special
>> > characters?
>> > I need to import CSV files to Mysql with lots of different characters.

>>
>> > for example: the original data is "SA-â-Gal Staining" and the import
>> > data is: "SA-² -Gal Staining"

>>
>> > another example: "50 ìL "
>> > converted to: "50 1/4 g"

>>
>> First, discover what encoding the csv file is in.
>>

>
> the file is saved as unicode (UTF-8) CSV


And how do you check your output? If by HTML/browser, do you send it a
header("Content-Type: text/plain; charset=utf-8") ? (or text/html, or is
the webserver or PHP (set dafault_mimetype & default_charset) configured
to do so?)
--
Rik Wasmus
  Réponse avec citation
Vieux 24/04/2008, 12h27   #5
matech
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: CSV fgetcsv() import removes special chars link â

On Apr 24, 10:07Âam, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 24 Apr 2008 11:03:43 +0200, matech <robert.mat...@hotmail.co.uk> Â
> wrote:
>
>
>
>
>
> > On 23 Apr, 14:36, "Peter H. Coffin" <hell...@ninehells.com> wrote:
> >> On Wed, 23 Apr 2008 04:55:57 -0700 (PDT), matech wrote:
> >> > how can I import CSV/TXT files without PHP removing special
> >> > characters?
> >> > I need to import CSV files to Mysql with lots of different characters..

>
> >> > for example: the original data is "SA-â-Gal Staining" and the import
> >> > data is: "SA-² -Gal Staining"

>
> >> > another example: "50 ìL "
> >> > converted to: "50 1/4 g"

>
> >> First, discover what encoding the csv file is in.

>
> > the file is saved as unicode (UTF-8) CSV

>
> And how do you check your output? If by HTML/browser, do you send it a Â
> header("Content-Type: text/plain; charset=utf-8") ? (or text/html, or isÂ
> the webserver or PHP (set dafault_mimetype & default_charset) configured Â
> to do so?)
> --
> Rik Wasmus- Hide quoted text -
>
> - Show quoted text -


thanks Rik.
I set the webserver default_mimetype and it worked. (the result: "SA-β-
Gal Staining")
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h20.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,87357 seconds with 13 queries