• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML Number encoding - User Input

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have a password field. The user enters some characters in it (say asdfgh12). Is there a way in HTML that before I send this password to the server, I can encode it in the HTML Number format (like {) for all the characters? Is there a special HTML function or do I have to encode it explicity using a javascript function?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no such thing as an "HTML function". Any scripting on a page is done in JavaScript.

What kind of encoding are you after, and for what reason?
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to have all the characters as &#xyz; encoded when they reach my server.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, instead of sending "ABC" to the server you want to send "ABC"? I'm sure you could write some Javascript to do that. The key step would be finding a Javascript function to convert a character to its Unicode code point value.

But the point of doing that escapes me too. What's the reason for doing that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope that you are not thinking that this affords you any level of security.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A legacy app needs support for special characters. Migrating database to UTF-8 seems expensive. I tried with some of the characters that are supported by the current charset of the legacy app and when they reach the server, I see them by default coded as ř

For example if I enter the following hjkläb, when they reach the server, I see them as hjklêb.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:So, instead of sending "ABC" to the server you want to send "ABC"? I'm sure you could write some Javascript to do that. The key step would be finding a Javascript function to convert a character to its Unicode code point value.

But the point of doing that escapes me too. What's the reason for doing that?


Already wrote a javascript function that would do this for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic