Special characters, specifically ampersand, in JSON server-side population not displaying in grid?

Special characters, specifically ampersand, in JSON server-side population not displaying in grid?

mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
edited February 2011 in General
I have an ampersand in my dataset.
Say my dataset is:

Row 1:

column 1: TEST&THIS

Row 2:

column 1: TEST & THIS

Row 3:

column 1: TEST& THIS

Row 4:

column 1: TEST &THIS

ACTUAL RESULTS:

TEST
TEST & THIS
TEST& THIS
TEST

In the first row, where there is no space before nor after the ampersand, the data comes back with everything from the ampersand and afterwards stripped off.
In the second row, where there is a space before AND after the ampersand, the data comes back perfectly.
In the third row, where there is a space AFTER the ampersand, the data comes back perfectly.
In the fourth row, where there is a space BEFORE but NOT AFTER the ampersand, the data comes back with everything from teh ampersand and afterwards stripped off.

It seems there MUST be a space after the ampersand, or everything from the ampersand on gets cut off in the UI.
However, at run time in the javascript, if I capture what row the user clicks, and grab the data from that column, it oddly comes back with the correct value, not truncated.

I would simply like the values to be displayed as they are. NO truncation at all.
I tried URL encoding and that didn't help. It actually displayed the URL encoding, not the standard value.

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    edited February 2011
    If you use & does that do what you are looking for - it sounds like the HTML engine is trying to render it as an entity.

    Allan
  • mvelasquezmvelasquez Posts: 17Questions: 0Answers: 0
    Yeah, that worked, thanks.
    I encoded it before sending it to the client.

    Thx.
  • gzhugzhu Posts: 3Questions: 0Answers: 0
    Blame it on IE's innerHTML function. It'll cut off from the last "&" in the last word of the string passed to it. As it tries to render without first making sure it's a valid encoding, probably fails silently, so the rest of the word just get dropped. Same for the "<" character.
This discussion has been closed.