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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:29:14+00:00 2026-05-29T22:29:14+00:00

Code below contains a JS function that receives as parameter String €€ (Euro sign).

  • 0

Code below contains a JS function that receives as parameter String “€€” (Euro sign).
I need to convert each one of these characters to its ASCII-extended integer equivalent (128 with ISO-8859-1).

However, t[0] and t[1] take value “8364” instead of “128”. What am I doing wrong? Please note that if I use UTF-8 instead of ISO-8859-1, they take value 65533 and in the JS debugger (Chrome and IE developer tools) a question mark is displayed instead of € symbol.

Thanks a mil

<html>
<head>
<meta http-equiv="Content-Type" content="text/javascript; charset=ISO-8859-1">
<title>JavaScript Scripting</title>
</head>
<body>
<script type="text/javascript" charset="ISO-8859-1">
function d(s) 
{
    var data = (s + "").split("");
    var dataLength = data.length;
    var t = [dataLength],n;

    for(n=0;n<dataLength;n++)
    t[n]=data[n].charCodeAt(0);
}
d("€€");
</script>
</body>
</html>

Full story is that I pasted this “€€” from file “output.js”, where these two bytes were written by Java code below, representing integers [128,128]. That is why I need t[0] and t[1] to get value 128.

res.setContentType("application/octet-stream"); 
res.setHeader("Content-Disposition","attachment;filename=output.js;charset=ISO-8859-1");
ServletOutputStream os = res.getOutputStream();
char result[]=encode(req.getParameter("originalScript"));
// result[0] and result[1] have here integer value 128
String result2=new String(result);
// result2 is displayed here as non printable characters (blank)
os.print(result2);
// On output.js "€€" is displayed
  • 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-29T22:29:14+00:00Added an answer on May 29, 2026 at 10:29 pm

    You have to make sure that the file is actually saved as ISO-8859-1, but that is actually not possible as there is no € character in that character set.

    “ISO/IEC 8859-1 is missing […] the euro sign.”

    http://en.wikipedia.org/wiki/ISO/IEC_8859-1

    As you are getting the character code 8364, the file is most likely saved as UTF-8, as that character code corresponds with the unicode character €.

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

Sidebar

Related Questions

Hello friends i am running code given below which contains the setLogTimeEntery function and
The code below works great. I have a MySQL database that contains book titles
Below is my entire code from a User control that contains the YUI Uploader.
I'm trying to alter the code below so that if this contains the class
I have the below code for my a Dialog box for a which contains
The code below shows a sample that I've used recently to explain the different
I have divs that are initially closed. The code below then controls the opening/closing:
I have created my application that has search form and below contains results for
I have a loading image that works using the code below. It shows the
I have a find function that locates a string in a JTable with quite

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.