Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-03-15
17
Medium Priority
?
541 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
  • 7
  • 5
  • 3
  • +1
16 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

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.

Question has a verified solution.

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

Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
This applies to Dell but may also apply to other manufacturers as well. We ran across a few machines that just dropped recently it trust relationship with the server. After doing the basic removing and joining the domain again, it changed to No logo…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

581 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