We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    ronaldlokers Reply #1, 14 years ago
    How can I change this when another charset is used for a language (for example Chinese):
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 17802
      • 190 Posts
      I think you should create a chunk for each language with the name of the right characterset in each one. Call these chunks charset_nl, charset_cn etc and then do this:
      <meta http-equiv="Content-Type" content="text/html; charset=[[YAMS? &get=`chunk` &from=`charset`]]" />


      Should work, no?
        Thanks for MODx - I love it!
        • 25483
        • 741 Posts
        ronaldlokers Reply #3, 14 years ago
        Thanks Maaike, that should do the trick!
          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 22851
          • 805 Posts
          PaulSuckling Reply #4, 14 years ago
          Thanks Maaike, you beat me to it. I was going to suggest a slightly easier solution for getting a language dependent charset that doesn’t require chunks:
          [[YAMS? &get=`text` &from=`en::US-ASCII||cn::UTF-8`]]

          I have a question though. MediaGuy, do you really want different languages to have different character sets? There is only one database, which will store the content as if it is written in one character set, and the manager can only operate in one character set... so aren’t you going to get into trouble if you try to serve the content as if it were written in two different character sets? I am not sure how this is going to work and at which point the character set conversion is going to take place. My suggestion would be to choose a unicode character set and stick with that for the database, manager and output encoding for all languages. It’s very difficult to go wrong that way.
            YAMS: Yet Another Multilingual Solution for MODx
            YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
            Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
            • 25483
            • 741 Posts
            ronaldlokers Reply #5, 14 years ago
            That’s something I didn’t think of!

            The problem is that we need to add a Chinese language. What charset should I use to support that and other ’normal’ languages? I’m not sure if my current charset (UTF-8) will support it.
              with regards,

              Ronald Lokers
              'Front-end developer' @ h2o Media

              • 22851
              • 805 Posts
              PaulSuckling Reply #6, 14 years ago
              Yes. Use UTF-8. You’ll be fine.

              If you want to support multiple languages easily then you need to use a unicode encoding (like UTF-8, UTF-16LE, UTF-16BE). Unicode defines codes for every character you could possibly imagine, in all langauges. They unicode variants listed above differ only in terms of the way they store the character codes behind the scenes. UTF-8 ends up using 1 byte per character code for Latin characters, but almost certainly uses 3 bytes per character for Chinese characters. UTF-16LE and UTF-16BE on the other hand use (for the most part) 2 bytes per character for both Latin and Chinese. So, if you wanted more of a compromise across languages in terms of the number of bytes per page in the different languages then you could use UTF-16LE or UTF-16BE for everything (database, manager, document output...), but it is pretty common practice in web design to use UTF-8 these days, so I’d stick with that to avoid complications.
                YAMS: Yet Another Multilingual Solution for MODx
                YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.