?
Solved

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

Posted on 2005-03-15
17
Medium Priority
?
526 Views
Last Modified: 2010-07-27
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
0
Comment
Question by:Michel Plungjan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
  • +1
17 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 13542949
>> 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
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 13543032
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
 
LVL 35

Expert Comment

by:TimYates
ID: 13543044
Can't you use double quotes in your javascript for String delimiters?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 35

Expert Comment

by:TimYates
ID: 13543047
eg:

"Systeme et procede pour fournir des donnees de telediffusion d&#039;internet sur la base d&#039;une structure hierarchique"
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13543052
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
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13543092
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
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 13543093
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
 
LVL 35

Expert Comment

by:TimYates
ID: 13543159
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
 
LVL 35

Expert Comment

by:TimYates
ID: 13543171
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
 
LVL 35

Expert Comment

by:TimYates
ID: 13543246
>> (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
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 13543825
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
 
LVL 35

Expert Comment

by:TimYates
ID: 13543868
>>  Euuuuw...

 Euuuuw indeed ;-)

Glad you got it sorted :-)

Tim
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13543951
don't worry, we've all done something similar (or in my case, often worse!) ;-)
0
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 13547385
Actually, it seems IE still pukes on the &#039; inside script :(((((
Will test more tomorrow... SO ANNOYING!
0
 
LVL 75

Author Comment

by:Michel Plungjan
ID: 13599971
Using &#027; seems to work

Michel
0
 

Accepted Solution

by:
OzzMod earned 0 total points
ID: 13638486
Closed, 250 points refunded.
OzzMod
Community Support Moderator (Graveyard shift)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question