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. [Solved]Swedish sp letters
Forum Updated to NodeBB v4.3 + New Features

[Solved]Swedish sp letters

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 3.0k Views 1 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.
  • T Offline
    T Offline
    toho71
    wrote on last edited by
    #1

    Could someone explain to me why my Swedish Letters (å,ä,ö) doesnt work in my QT application.
    I have tried to change the encoding to Latin 1 as someone suggested but No.
    It works fine when i put the letters as text on buttons etc in the designer mode but not when i try to change them in the code.
    I work in Debian 6.0

    New Ideas pls.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Try with Unicode encoding.

      http://anavi.org/

      1 Reply Last reply
      0
      • M Offline
        M Offline
        morinehtar0
        wrote on last edited by
        #3

        When you put literal text in your code, it gets transferred to a QString using LAtin/standard ascii, I think.
        But since your text probably contains utf8, it goes wrong.

        To tell QString to read your text as utf8, you can do:
        @QString::fromUtf8("your text")@

        Hope this helps...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          "This":http://developer.qt.nokia.com/wiki/Strings_and_encodings_in_Qt is a work-in-progress wiki page on the topic, but there are also several forum discussions on this already.

          Basically, there are two approaches, and opinions among developers differ in what the best and what the most workable way of doing it is.

          use the idea outlined in the wiki page above, by explicitly using UTF-8 encoding for your source files, setting the codecs, right, and explicitly TR_UTF8 and the likes. Personally, I think this is too easy to break, but that is just me.

          don't put the non-ASCII texts in the source code directly, but use Qt Linguist to translate your application. That way, there is nothing special to do in your code, except install the translation at startup. The translation file can be put in a resource and thus compiled in, if you want.

          Personally, I keep my string literals in the source code in English, but you may just as well use any other language including Swedish, as long as you don't use non-ascii characters. Then, in Linguist, you create your Swedish, correctly spelled translation. I do that for English as well. Most strings don't need actual translation, but it is very useful for things like plurals ("one item found" vs. "3 items found").

          1 Reply Last reply
          0
          • T Offline
            T Offline
            toho71
            wrote on last edited by
            #5

            Thank you for your answers.
            I think that this is a problem I have to solve with the Andre solution

            1 Reply Last reply
            0

            • Login

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