Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    1
    Thanks
    0
    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:
    Code:
    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.
    Code:
    str.replace( /ú/g, "/xfa־" );
    What can I do?

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    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:

    Code:
    <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 04: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
    •