Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts

    Question How to force plugin charset/encoding?

    Hi! I'm having a trouble with my mobile plugin: it shows me the new elements added by scripting with a different charset of the page. E.g. I can read "cuadrúpedo" but the same word in my plugin show "cuadr¡pedo".

    I tryed writing the next line to the beginning of my plugin, but it didn't work:
    document.getElementsByTagName("html")[0].setAttribute("lang", "es");
    Then, I wrote a "converter function" which replaces the special characters with unicode, like the next line, bub it didn't work.
    str.replace( /ú/g, "/xfa־" );
    What can I do?

  2. #2
    Senior Coder
    Join Date
    Apr 2011
    London, England
    Thanked 354 Times in 353 Posts
    document.getElementsByTagName() is available only when the page (or possibly part of it) has been loaded/rendered. Although I know very little about using other languages it seems logical to me that it is too late to change the language of the page(?) once it has been rendered.

    The character encoding may also be required:

    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    although I suspect this is the default.

    If you are only adding a section of the page then you could add lang="es" to, for example, a DIV and then insert the content into this div.
    Last edited by AndrewGSW; 12-08-2012 at 05:13 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts