Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.python > #3983

Re: Un caractère spécial...

Path csiph.com!pasdenom.info!usenet-fr.net!.POSTED!not-for-mail
From Olivier Miakinen <om+news@miakinen.net>
Newsgroups fr.comp.lang.python
Subject Re: Un caractère spécial...
Date Wed, 19 Oct 2022 17:18:56 +0200
Organization There's no cabale
Lines 24
Message-ID <tip4h0$1t3o$1@cabale.usenet-fr.net> (permalink)
References <TridnT4a0poIcNL-nZ2dnZfqlJxg4p2d@giganews.com>
NNTP-Posting-Host pa-129.182.162.217.frcl.bull.fr
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace cabale.usenet-fr.net 1666192736 62584 129.182.162.217 (19 Oct 2022 15:18:56 GMT)
X-Complaints-To abuse@usenet-fr.net
NNTP-Posting-Date Wed, 19 Oct 2022 15:18:56 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.1
In-Reply-To <TridnT4a0poIcNL-nZ2dnZfqlJxg4p2d@giganews.com>
Xref csiph.com fr.comp.lang.python:3983

Show key headers only | View raw


Bonjour,

Le 19/10/2022 à 14:29, duareb a écrit :
> Après l'importation d'un fichier texte de nombres entiers , les éléments ont été
> transformés : par exemple  l'entier écrit  '1 549' est devenu   '1 549',

Visiblement, le fichier était en UTF-8, et après l'importation il est lu
comme si c'était du CP1252 (version Windows du Latin1).

En effet,   = E2 80 AF (en CP1252), et l'encodage UTF-8 E2 80 AF est
celui de l'espace insécable étroite U+202F ( ).

Pour obtenir une conversion parfaite, tu dois arriver à dire que tu pars
d'un fichier UTF-8, et si possible que tu veux aussi avoir à l'arrivée
un résultat en UTF-8, puisque le caractère « espace insécable étroite »
n'existe pas dans CP1252.

Sinon, si tu veux juste virer ces caractères, tu peux soit le faire dans
le fichier texte avant importation, soit dans le résultat importé en
utilisant des expressions rationnelles si tu ne peux pas copier-coller
le caractère macron.

-- 
Olivier Miakinen

Back to fr.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Un caract�re sp�cial... duareb <nospam_duareb@free.fr.invalid> - 2022-10-19 12:29 +0000
  Re: Un caractère spécial... Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2022-10-19 14:49 +0200
  Re: Un caractère spécial... Olivier Miakinen <om+news@miakinen.net> - 2022-10-19 17:18 +0200
  Re: Un caractère spécial... ast <ast@invalid> - 2022-11-10 14:48 +0100

csiph-web