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

  • Home
  • SEARCH
  • 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 5844165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:15:15+00:00 2026-05-22T12:15:15+00:00

My JavaScript get string value from server: var name = VALUE_FROM_SERVER; This name will

  • 0

My JavaScript get string value from server:

var name = VALUE_FROM_SERVER;

This name will be shown on a web page, since name contains Scandinavian letter (for example, name could be TÖyoeävä) I need to encode it somehow to display it correctly on the browser.

In JavaScript, what is the most efficient way to encode all those Scandinavian letters?

(I prefer to do it with Javascript.)

(e.g. I would like to create a JS function which takes TÖyoeävä as parameter and returns TÖyoeävä)

var encoder=function(string){
  for(var s=0; s<string.length; s++){
        //Check each letter in the string, if it is Scandinavian, encode it?? 
  }

}
  • 1 1 Answer
  • 0 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-22T12:15:16+00:00Added an answer on May 22, 2026 at 12:15 pm

    I’d advise you not to encode in the JS. Just make sure your (html) page encoding matches what your server is returning.

    Preferably, that would be a UTF-8 encoding (to be able to support other languages down the road). But if it’s just Scandinavian languages you’re interested in, ISO-8859-1 (Latin 1) is enough.

    There’s no way to tell from a random byte string if it’s one encoding or another (generally speaking anyway). So you have to know in your Javascript what encoding the server is sending.

    You also have to set your page’s encoding at some point, and that point has to be before the browser starts interpreting its content.

    So all in all, getting encoding A from the server en converting to encoding B on the client side is going to be tricky, and pretty much a waste of time (IMO). You’re not gaining any flexibility that I can see, except allowing your server to change encodings, which doesn’t seem like such a good idea.

    UTF-8 all the way will save you headaches.

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

Sidebar

Related Questions

Is it possible for a web page using Javascript to get data from another
The javascript does not get value from the web method. It says undefined for
I need value to be passing from ASP.NET page to JavaScript and then to
I'm trying to build up a string array in JavaScript and get the results
So far, I've only been passing javascript strings to my web methods, which get
I am using javascript to get the referring page (document.referrer) which works fine and
I'm looking for a way using jquery/javascript to get a class name when I
HTML Javascript question to get the selected value of a input-select I can use
I have a div on page, which content will change by javascript, I want
$(#submit).click(function(){ var query=getquerystring() ; //get the query string entered by user // get the

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.