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


Groups > it.comp.www.php > #21713

Problema Charset e mb_detect_encoding

From NoS <NoS@nospam.no>
Newsgroups it.comp.www.php
Subject Problema Charset e mb_detect_encoding
Date 2017-09-10 10:06 +0200
Organization Aioe.org NNTP Server
Message-ID <op2rqb$1gpu$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Devo elaborare una stringa (non ho controllo a monte, devo prendere la 
stringa e ridarla in HTML-ENTITIES).

Esempio di stringhe problematiche:
1 - Atà Trinità;
2-  Atà Trinit� (il diamond è sempre una "à").


La 1, per avere il giusto output la devo trattare così:

$stringa_1 = mb_convert_encoding($stringa, "HTML-ENTITIES", "UTF-8");

Ma se tratto la 2 allo stesso modo il risultato in uscita è:

- At� Trinit�

Allora avevo pensato di creare un metodo per testare che tipo di 
codifica mi entrava ed ho preprocessato la stringa con:

     $res = mb_detect_encoding ($stringa, "auto");

Il problema è che il risultato per entrambe le stringhe è "UTF-8", 
quindi non so come comportarmi.

Cosa sto sbagliando?

Grazie in anticipo









Back to it.comp.www.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Problema Charset e mb_detect_encoding NoS <NoS@nospam.no> - 2017-09-10 10:06 +0200
  Re: Problema Charset e mb_detect_encoding Leonardo Serni <lserni@gmail.com> - 2017-09-13 21:24 +0200
    Re: Problema Charset e mb_detect_encoding NoS <NoS@nospam.no> - 2017-09-14 08:54 +0200
      Re: Problema Charset e mb_detect_encoding Alessandro Pellizzari <shuriken@amiran.it> - 2017-09-14 12:51 +0100

csiph-web