[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

=?iso-8859-1?Q?RE=3A_=5Bxsl=5D_url_encoding_gets_wrong_with_=E5=F6=E4=3F?=


Subject: RE: [xsl] url encoding gets wrong with åöä?
From: "Niklas Holmberg" <Niklas.Holmberg@xxxxxxxxx>
Date: Thu, 8 Jun 2006 10:41:48 +0200

Hi again!

Just one more thing regarding this... My output starts with the line <ul
xmlns:javaUrlEncoder="java.net.URLEncoder" id="tagcloud">
How can i get rid of the xmlns part? I don't want it there...

Here's my code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:javaUrlEncoder="java.net.URLEncoder">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
	<ul id="tagcloud">
	<xsl:for-each select="root/row">
	<xsl:sort select="word"/>
		<li class="weight1"><a><xsl:attribute
name="href">http://gulasidorna.eniro.se/query?what=yp&amp;search_word=<xsl:va
lue-of select="javaUrlEncoder:encode(word,
'ISO-8859-1')"/></xsl:attribute><xsl:value-of select="word"/></a></li>
	</xsl:for-each>
	</ul>
</xsl:template>
</xsl:stylesheet>

Thanks!
/Niklas

-----Original Message-----
From: Niklas Holmberg [mailto:Niklas.Holmberg@xxxxxxxxx]
Sent: den 7 juni 2006 13:32
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] url encoding gets wrong with evd?


Thank you so much =) This is great!
Finally it works using the two-argument form of java.net.URLEncoder.encode()

Thanks everyone who has helped me out =) /Niklas

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]

Sent: den 7 juni 2006 13:04
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] url encoding gets wrong with evd?

This thread seems to have gone off at a complete tangent.


(a) There are any number of editors that handle iso-8859-1 on Windows, or at
any rate cp-1252 which is a good enough approximation for present purposes.
This isn't the issue.

(b) Calling an extension function to do URL encoding is a perfectly reasonable
thing to do if you want to achieve something that the standard XSLT-generated
encoding doesn't do. However, the suggestion that the encoding used by the
extension function depends on the encoding of the stylesheet containing the
call to the extension function seems pretty implausible.

In fact, the one-argument form of java.net.URLEncoder.encode() uses the
default encoding of the platform, and is deprecated for that reason. There is
a two-argument form in which the second argument is the encoding you want to
use, for example "UTF-8" or "ISO-8859-1". The documentation of this method
states clearly:

Note: The  World Wide Web Consortium Recommendation states that UTF-8 should
be used. Not doing so may introduce incompatibilites.

None of this gets to the root of the problem, which is why percent-encoding
the URL using UTF-8 encoding, as specified in all the standards, isn't working
in your case. In general, it's a good idea to understand a problem before you
start groping around in a blind search for a workaround.

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Abel Braaksma Online [mailto:abel.online@xxxxxxxxx]
> Sent: 07 June 2006 11:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] url encoding gets wrong with evd?
>

> Hi Niklas,
>

> Eclipse is free: www.eclipse.org. It is a development environment and

> it can help you with developing XML, XSLT and programming (if you'd

> need it). You can find any nice text editor in this list:
> http://en.wikipedia.org/wiki/List_of_text_editors. Decide which you

> want based on it's capability of viewing a text-only document in

> different encodings.
>

> As a matter of fact, you can judge the encoding of your document by

> loading into Internet Explorer (as a .txt file) and choose some

> different encodings from the View --> Encoding menu. A handy shortcut

> I often find myself using when I have to find out what encoding /

> language a text is in (I do business with some Baltic states, have a

> different character map than your Latin-1).
>

> Cheers,
> Abel
>

> Niklas Holmberg wrote:
>

> >I don't have eclipse. Anybody know a good editor (for
> windows) that can save correct ISO-8859-1 documents?





Confidentiality Notice: This e-mail transmission may contain confidential or
legally privileged information that is intended only for the individual or
entity named in the e-mail address. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or reliance
upon the contents of this e-mail is strictly prohibited and may be unlawful.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete all copies of this message.





Confidentiality Notice: This e-mail transmission may contain confidential or
legally privileged information that is intended only for the individual or
entity named in the e-mail address. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or reliance
upon the contents of this e-mail is strictly prohibited and may be unlawful.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete all copies of this message.


Current Thread
Keywords