473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Mac Safari and urlencoding non-latin characters

Hi,

I have a web service with a javascript line like this to send
user input to another frame:

<code>
parent.isk_artlist_top.location.href='artlist_top. asp?ss='+escape(document.h
aku.sana.value)+'&base='+document.haku.base.value+ '#activeword';
</code>

the problematic part being this ----> escape(document.haku.sana.value)

It works well on all other browsers, but Mac's Safari doesn't encode
the non-latin characters. Changing the charset to UTF-8 solves the
problem, but is there any way to get it working with iso-8859-1?

R.Kangas
Jul 23 '05 #1
2 2574
Riku Kangas schrieb:
<code>
parent.isk_artlist_top.location.href='artlist_top. asp?ss='+escape(document.h
aku.sana.value)+'&base='+document.haku.base.value+ '#activeword';
</code>

the problematic part being this ---->
escape(document.haku.sana.value)

It works well on all other browsers,
Most certainly you have neither tested with *all* other browsers nor
would that mean anything.
but Mac's Safari doesn't encode the non-latin characters.
As it should not. If escape() is used for URIs, it should be compliant
to RFC 1738, section 2.2, and/or RFC 2396, section 2.1, which specify
that only US-ASCII characters should be escaped (if they are reserved
and not used in such a meaning) unless the URI encoding is specified.
However, RFC 1738 and RFC 2396 do not define means to specify the
encoding for URLs/URIs in general nor do RFC 1945 (HTTP/1.0) or RFC 2616
(HTTP/1.1) for http URLs.
Changing the charset to UTF-8
How, exactly?
solves the problem, but is there any way to get it working with
iso-8859-1?


I don't think so. There is a lot of proprietarity involved here.

escape() is a proprietary method, its implementation is only *suggested*
in ECMAScript 3, section B.2.1 (and explicitely not adhering to RFC
1738, updated by RFC 2396, there). Using Unicode escape sequences in
URIs is not backed up by RFCs either, so it is proprietary behavior if a
HTTP server decides to interpret all escape sequences in URIs as UTF-8
escape sequences (in order to map two-byte, three-byte and four-byte
sequences to Unicode [4.0] characters accordingly). That a UA is
converting Unicode characters in URI to Unicode escape sequences prior
to sending the HTTP request is proprietary behavior as well (see above).

There are no means to specify the URI encoding that are backed up by
RFCs, so there is no standards-compliant way for the UA to tell the
HTTP server the encoding used for escaping the URI characters. The
server could be possibly configured to take escape sequences specifying
a code point in the range 0x80..0xFF as escape sequences for ISO-8859-1
characters. That would be proprietary behavior, though.

The standards-compliant encodeURIComponent() method of ECMAScript 3 is
not available everywhere and AIUI it is not fully compliant to the RFCs
mentioned either.

It could help to make POST requests instead of GET requests where the
encoding of the POST *data* can be properly specified. That would
require either a HTML form to be submitted or a HTTP API with ECMAScript
language binding (such as XMLHttpRequest) as well as the server-side
application to process POST data (using the Request.Form collection
in ASP).

The best solution, though, is plain and simple: Do not use non-ASCII
characters in URIs, so do not use them in names of files to become
Internet resources unless you also do server-side redirection/URL rewriting.
PointedEars
Jul 23 '05 #2
Thank you Thomas for your very thorough answer.
-R.Kangas
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David | last post by:
On every web browser except Safari, this website works great. (Well, by "every" I mean Mozilla, Netscape, and Internet Explorer, for Mac and Windows). The site is: http://www.ruleofthirds.com ...
4
by: metoikos | last post by:
I've scoured the web (clumsily, I'm sure) for information on the difficulties I am having, checked my markup in validators, and had a friend with more CSS clue look over it, but I haven't had any...
34
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
16
by: Edward | last post by:
Hi All, I am having huge problems with a very simple dotnet framework web page (www.gbab.net/ztest3.aspx) , it does NOT render correctly under Apple's Safari. The DIV's do not align amd float as...
2
by: ipy2006 | last post by:
Only in Safari browser the current year shows as 1970. Also "Non digits found in year" is triggered in the Safari broswer. Please help. Thanks, Yasaswi function verifyYear( field ) { var _x =...
3
by: dd | last post by:
Hi, I have some code that hides all Flash objects on a page. It's working fine on IE and Gecko but doesn't work on Safari. There are no errors (shown in the console) when it runs on Safari, and...
2
by: JDeats | last post by:
>From my development envrionment (i.e. a single WinXP notebook PC) I have a basic AJAX application that is making the call to a Windows Form page that just returns the request back to the AJAX...
3
by: Brad | last post by:
I have an aspx page that is sending pdf files to client browsers: it uses a filestream to read the pdf file and response.binarywrite to send content to the browser. This has worked great for years...
15
by: GinnTech | last post by:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the latest Safari. Here is the issue. I am attempting to call functions within a flash object. When trying to attempt to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.