Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stream file codification
Forum Updated to NodeBB v4.3 + New Features

Stream file codification

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 752 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JulianJ Offline
    JulianJ Offline
    Julian
    wrote on last edited by Julian
    #1

    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.

    S 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • JulianJ Julian

        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.

        S Offline
        S Offline
        stryga42
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved