JSP/TILES: ' is not recognised in IE, ' IS recognised TOO WELL by browsers

I have the following title
Systeme et procede pour fournir des donnees de telediffusion d'internet sur la base d'une structure hierarchique

so in my javascript I had converted to  because I need to wrap in single quotes

'Systeme et procede pour fournir des donnees de telediffusion dinternet sur la base dune structure hierarchique'

that produced square blocks in UTF-8
so I did this:

<c:out value="${sessionScope.requestedPatent.titleDisp}" escapeXml="true" />
which produce
'Systeme et procede pour fournir des donnees de telediffusion d&#039;internet sur la base d&#039;une structure hierarchique'

HOWEVER they were immediately recognised as single quotes and bombed my javascript.

I know I can change to \' but are there no other way?
I use &quot; for the double quotes and that works just fine

Thanks

Michel
LVL 75
Michel PlungjanIT ExpertAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
>> I know I can change to \' but are there no other way?

Not that I can think of...but can you post your code?  Or a subset of it which shows the problem?
0
Michel PlungjanIT ExpertAuthor Commented:
I did...

The string is in UTF8.
this one
<c:out value="${sessionScope.requestedPatent.titleDisp}" escapeXml="true" />
changes single quotes to &#39;

and that results in
Error: missing ) after argument list
Source Code:
....('Systeme et procede pour fournir des donnees de telediffusion d'internet sur la base d'une structure hierarchique',)

even though view source shows me
'Systeme et procede pour fournir des donnees de telediffusion d&#039;internet sur la base d&#039;une structure hierarchique'

I will try urlencoding now
0
TimYatesCommented:
Can't you use double quotes in your javascript for String delimiters?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

TimYatesCommented:
eg:

"Systeme et procede pour fournir des donnees de telediffusion d&#039;internet sur la base d&#039;une structure hierarchique"
0
bloodredsunCommented:
Aren't single apostrophes &#039; with a 0.

You could also try double escaping it when you output from JSTL it so it becomes &amp;#039; although it's difficult without some code to look at.
0
bloodredsunCommented:
Sorry Tim, slow page refresh (I though I'd better say something so we don't end up at each others throat like objects and CEHJ!)
0
Michel PlungjanIT ExpertAuthor Commented:
Yes they are 039, as shown in the last example. Sorry about that.
Perhaps I can use 027 then... I was using &#27; which became squares on the page...

I cannot use double quotes since it is inside an onClick event
onClick="bla('System.....')"
0
TimYatesCommented:
This works...

But it aint pretty:

<html>
  <body>
    <script language="JavaScript">
      function splong( s )
      {
        return s.replace(/'/g,'\'');
      }
    </script>
    <a href="#" onclick="alert( splong( &quot;tim&#39;s test&quot; ) )">clicky</a>
  </body>
</html>

I feel ill now ;-)

hehehehe
0
TimYatesCommented:
Actually...

this works:

<html>
  <body>
    <a href="#" onclick="alert( &quot;tim&#39;s test&quot; )">clicky</a>
  </body>
</html>

Use &quot as your String delimiters...

maybe...  I have only tried this on Firefox, and my spidey senses tell me it a complete hack ;-)
0
TimYatesCommented:
>> (I though I'd better say something so we don't end up at each others throat like objects and CEHJ!)

Hehehee...  I'm not as arsed as either of them ;-)

>> I have only tried this on Firefox

Tested it on IE6 too...and it works there as well...
0
Michel PlungjanIT ExpertAuthor Commented:
Euuuuw...


Anyway. I apologise for having wasted everybody's time...

<c:out value="${sessionScope.requestedPatent.titleDisp}" escapeXml="true" />

works just fine with the &#039; BUT ONLY if the page IS in UTF-8
I had recompiled my project and an old ISO-8859-1 snuck in in the meta tag and that messed things up.

It works fine now.

Sorry again

Michel
0
TimYatesCommented:
>>  Euuuuw...

 Euuuuw indeed ;-)

Glad you got it sorted :-)

Tim
0
bloodredsunCommented:
don't worry, we've all done something similar (or in my case, often worse!) ;-)
0
Michel PlungjanIT ExpertAuthor Commented:
Actually, it seems IE still pukes on the &#039; inside script :(((((
Will test more tomorrow... SO ANNOYING!
0
Michel PlungjanIT ExpertAuthor Commented:
Using &#027; seems to work

Michel
0
OzzModCommented:
Closed, 250 points refunded.
OzzMod
Community Support Moderator (Graveyard shift)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.