Stream file codification



  • What codification I should use for QTextStream to write spanish. Because Spanish has an accent. For example this it's a text:

    Por más que he probado codificaciones la que mejor quedó es ISO-8859-1.

    I tried several and the one I found the best it's ISO-8859-1.

     QTextStream stream (&archivo);
     stream.setCodec("ISO-8859-1");
    

    But sometimes it's goes wrong, for example this a text print


    Intersección: ALMAFUERTE Y RONDEAU
    Marca:
    Característica:
    Modelo:
    Red: Autónomo
    Tiempo:
    Peatonal:
    Tecnología:
    Cantidad:
    Descripción:
    Fecha instalación: No especificado
    Reparación: algo m�s se agrega
    algo mas se agrega


    If you see, in Reparación there must be algo más and not algo m�s

    That was the only problem I saw, the other accent are good.


  • Lifetime Qt Champion

    Hi,

    Don't get too fancy, use UTF-8.



  • @Julian Fully agree with SGaist - use UTF-8. And be carefull what sort of widget or steram you use for finally printing your text - maybe not QTextStream is the problem but something downstream.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.