This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Escaping a utf-8 string


On Sat, Aug 17, 2002 at 03:10:46PM -0600, Mike Brown wrote:
> Wesley W. Terpstra wrote:
> > I have considered using a binary search to find the char, but since
> > there is no "unicode numeric code -> string" function in xsl either that
> > I have found, this won't work either. If such a function did exist, this
> > would be relatively speedy.
> 
> Right. The only option I can see is to create and use an extension function,
> which I think you said you didn't consider viable?

Well, there is this uri-escape function in xpath 2.0:
	http://www.w3.org/TR/xquery-operators/#func-escape-uri
sadly, though, it only came into existence two months ago (Jun 17).

It would be enough since then "translate(escape-uri(str, true), '%', '=')"
would give me a suitable string for RFC822 headers when wrapped with
=?utf-8?Q?...?=

However, this function doesn't explain very clearly what is done for
non-ascii characters; are they represented by a utf-8 stream? I assume so
since the examples they give are compatible ascii and yet they must work on
all of unicode... I have sent a clarification to w3c regarding this.

> If portability is not an issue, you could use <msxsl:script>, and perhaps
> use http://www.macchiato.com/unicode/UTF.js as a starting point...

Portability is an issue. :-( The pages are all xml with the intention that
then browsers can use different xsl to format them to user taste.

Grrr. Maybe I will make a patch for libxslt1 and just let the IE users eat
it for now.

-- 
Wesley W. Terpstra <wesley@terpstra.ca>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]