Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 465243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:21:24+00:00 2026-05-12T23:21:24+00:00

Iam using a mixed approach of manual language translation, and google translation using jquery-translate

  • 0

Iam using a mixed approach of manual language translation, and google translation using jquery-translate libray. I have gotten the google method to work correctly, but google is missing some languages my employer’s client requires…

So I am using jquery to read an xml file that has english + french canadian languages, for a sample page, I am able to read the xml,and to use nodeContainsText to replace text on a page, however when I do so. the text’s accents that are displayed perfectly via google translation ie french.

So my problem is how do i get the xml data as a correct charset/content type, so as to display that correctly.

$(document).ready(function()
{
  $.ajax({
    type: "GET",
    url: "xmldata.xml",
    dataType: "xml",
    success: parseXml
  });
});
function parseXml(xml)
{

  //find every Tutorial and print the author
  $(xml).find("english").each(function()
  {
    $(this).find('phrase').each(function(){
        english[count] = $(this).text();
        console.log('Adding to english array..['+english[count]+']');
        count = count + 1;
    });
  });
  count = 1;
  $(xml).find("french_canadian").each(function()
  {
    $(this).find('phrase').each(function(){
        frca[count] = $(this).text();
        console.log('Adding to frca array..['+frca[count]+']');
        count = count + 1;
    });
  });

$('body').nodesContainingText().each(function(){

    // step 1 search through all text nodes

    var $el = $(this), text = $el.text() || $el.val();
    var nn = this.nodeName;


    // step 2 find position in english array for word
    for(var i=0;i<english.length;i++) {
        // step 3 replace with french canadian version from array
        if (english[i] == text) {
            // which node dot text = value
            console.log('Replacing...'+english[i]+' with '+frca[i]);
            $el.text(frca[i]);
        }
    }
});

}

As you can see I am using console.log via firebug to help debug where the content/charset issue comes from…

I just can’t seem to grasp the syntax to convert the data incoming from the xml file into a correct htmlentities coding..

I know it’s supposed to be .html() but when i add that, it just causes errors. So can someone give me a clue?

Thank You.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:21:24+00:00Added an answer on May 12, 2026 at 11:21 pm

    I eventually found the solution by changing the charset of the xml file directly to

    <?xml version="1.0" encoding="ISO-8859-1"?>
    

    That made all the accents from other languages instantly viewable…

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam using structure map for resolving my dependencies, however i have a rather special
iam using AVFoundation Framework to play mp3 file ,everything works great ، i have
I have created a C++/CLI mixed DLL which I am using from C# Winforms
I have started to do some programming using VIM. I have very mixed feelings
I am using Eclipse Indigo with an Android/NDK mixed project. I've added C++ nature
Iam using applet for an application. In that when ever a conditin satifies,it has
Iam using windows forms. How can I query all child controls of a Form
iam using setting.bundle and i try to show a hidden picture with Switch toggle
iam using c#,asp.net and iis, i want to simulate slow internet connection on my
EDIT: iam using ajax to load text in my content that is why onload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.