0

I'm working on a JSP which reads an XML to present an exercise. The user has some fields to fill in, which will be compared to data from the XML file. Now, the problem is that the values in the XML contains characters like à which is the à, but we do expect the user to fill in the à.

I've tried un-escaping and re-encoding and all, but I still haven't found the correct way to do this. Some people say just to write a function that re-encodes each letter, but the letter can be part of a word, so converting an entire answer letter per letter seems a bit overkill?

Anyone got any thoughts on this issue?

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
Andy
  • 395
  • 3
  • 17
  • Take a look at this answer: http://stackoverflow.com/a/4339144/1835379 – Cerbrus Nov 29 '12 at 14:21
  • possible duplicate of [Convert HTML Character Entities back to regular text using javascript](http://stackoverflow.com/questions/4338963/convert-html-character-entities-back-to-regular-text-using-javascript) – Kate Gregory Nov 29 '12 at 15:46

1 Answers1

0

Javascript understands UTF, so a client side method which encodes/decodes and evaluates equality should do the trick.

Here's a great article on the matter.

And here is some reading on how you could implement a client side function to accomplish what you need.

To answer your question - yes, it would be overkill to send the data to the server for conversion/evaluation, but also no - it wouldn't be overkill to handle this (the whole word conversion) client side via javascript.

Community
  • 1
  • 1
J.Wells
  • 1,749
  • 12
  • 13