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 6143309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:30:32+00:00 2026-05-23T18:30:32+00:00

I want to read a file from my server with javascript and display it’s

  • 0

I want to read a file from my server with javascript and display it’s content in a html page.
The file is in ANSI charset, and it has romanian characters.. I want to display those characters in the way they are 😀 not in different black symbols..

So I think my problem is the charset.. I have a get request that takes the content of the file, like this:

function IO(U, V) {//LA MOD String Version. A tiny ajax library.  by, DanDavis
var X = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
X.open(V ? 'PUT' : 'GET', U, false );
X.setRequestHeader('Content-Type', 'Charset=UTF-8');
X.send(V ? V : '');return X.responseText;}

As far as I know the romanian characters are included in UTF-8 charset so I set the charset of the request header to utf-8.. the file is in utf-8 format and I have the meta tag that tells the browser that the page has utf-8 content..

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

So if I query the server the direct file, the browser shows me the romanian characters but if I display the content of the page through this script, I see only symbols instead of characters..
So what I am doing wrong?

Thank you!

PS: I want this to work on Firefox at least not necessarily in all browsers..

  • 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-23T18:30:33+00:00Added an answer on May 23, 2026 at 6:30 pm

    While my initial assumption was the same as T.J. Crowder’s, a quick chat established that the OP uses some hosting service and cannot easily change the Content-Type headers.

    The files were sent as text/plain or text/html without any Charset paramter, hence the browser interprets them as UTF-8 (which is the default).

    So saving the files in UTF-8 (instead of ANSI/Windows-1252) did the trick.

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

Sidebar

Related Questions

I want to read the file path from html input type=file (the entry selected
I want to develope upload and download file from server. Upload.html <form action=/UploadFile/UploadFile method=POST
I want to read a file from a java web application. I don't want
I want to read line n1->n2 from file foo.c into the current buffer. I
I want to read lines from a file into a Set or List. Is
In my grails application I want to read some values from properties file and
I want to read each line from a text file and store them in
I want to read data about MMORPG characters from a .txt file and then
I have an INI file that I want to read the line DeviceName=PHJ01444-MC35 from
I want to be able to read from an unsorted source text file (one

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.