javascript, window.open, mailto and cyrillic texts...

J

John

Hi all,

actually I am facing a problem when open an email client with
window.open and cyrillic texts:

The situation:

function testMailTo() {
var subj = escape("some subject text in cyrillic");
var bod = escape("some body text in cyrillic");
window.open( 'mailto:[email protected]?subject='+subj
+'&body='+bod);
}

The text gets translated dynamically at server side. It works perfect
for French, German, Croatian, Czech and English. But as soon as I try
Cyrillic, the email client shows something like:

%u043D%u0456%u0442%u044C %u043D%u0430%u0441%u0442%u0443%u043F%u043D
%u0435 %u043F%u043E%u0441%u0438%u043B%u0430%u043D%u043D

for both the subject and the body text.

I absolutly have no idea what to do. Does anybody has an idea?

Thanks in advance
John
 
T

Thomas 'PointedEars' Lahn

John said:
actually I am facing a problem when open an email client with
window.open and cyrillic texts:

The situation:

function testMailTo() {
var subj = escape("some subject text in cyrillic");
var bod = escape("some body text in cyrillic");
window.open( 'mailto:[email protected]?subject='+subj
+'&body='+bod);

Use encodeURIComponent() instead of escape().

Do not use window.open() with `mailto:'; use `window.location' instead.
Users with browsers supporting tabbed browsing (the majority) will be
grateful.

Do not use `mailto:' URIs; use a server-side form-mailer instead.
Webmail-only and Internet café users, among others, will be grateful.
the email client shows something like:

%u043D%u0456%u0442%u044C %u043D%u0430%u0441%u0442%u0443%u043F%u043D
%u0435 %u043F%u043E%u0441%u0438%u043B%u0430%u043D%u043D

for both the subject and the body text.

Suppose the Cyrillic text used Unicode characters with code point beyond
U+00FF, that would implement the suggestion in Appendix B.2.1 of the
ECMAScript Language Specification (ECMA-262), Edition 3 Final, for the
proprietary escape() method where it says:

| [...]
| 6. Get the character (represented as a 16-bit unsigned integer) at
| position k within Result(1).
| 7. If Result(6) is one of the 69 nonblank characters
|
“ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./â€
| then go to step 13.
| 8. If Result(6), is less than 256, go to step 11.
| 9. Let S be a string containing six characters “%uwxyz†where wxyz are
| four hexadecimal digits encoding the value of Result(6).
| 10. Go to step 14.
| [...]
I absolutly have no idea what to do. Does anybody has an idea?

ECMA-262-3 has been published and its encodeURIComponent() method has been
implemented first approximately 9 years(!) ago (with JavaScript 1.5 in
Netscape 6, Phoenix [Firefox precursor]; JScript 5.5 in IE 5.5 and Windows
Me). RTFM (and dump the book in the likely case that your knowledge stems
from there).

<http://jibbering.com/faq/#posting>


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Thu, 29 Oct 2009 12:50:45, Thomas 'PointedEars' Lahn
Do not use `mailto:' URIs; use a server-side form-mailer instead.
Webmail-only and Internet café users, among others, will be grateful.

WRONG. It could read :

If possible, do not offer only `mailto:' URIs; also offer a server-side
form-mailer.

Webmail-only and Internet café users, among others, will be grateful
for the form mailer. Users of well-configured systems can also use
`mailto:' URIs, and may prefer to do so.



A good way of causing annoyance is to use a form-mailer with a default
size textarea to type in.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:
Do not use `mailto:' URIs; use a server-side form-mailer instead.
Webmail-only and Internet café users, among others, will be grateful.

WRONG. [...]

A less presumptuous poster would have written "IBTD" and the like.
Because it is a matter of opinion (and target user group), not of
right or wrong.


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Fri, 30 Oct 2009 20:46:54, Thomas 'PointedEars' Lahn
Dr said:
Thomas 'PointedEars' Lahn posted:
Do not use `mailto:' URIs; use a server-side form-mailer instead.
Webmail-only and Internet café users, among others, will be grateful.

WRONG. [...]

A less presumptuous poster would have written "IBTD" and the like.
Because it is a matter of opinion (and target user group), not of
right or wrong.

TWIT. Except on an intranet, or on pages addressed only to a similarly
limited readership, the target user group will be diverse in its
circumstances, particularly but not only in the software that it has
available and/or prefers.

Rejecting provision of the convenient "mailto:" is the act of a control
freak. Rejecting provision of "form-mail", where supportable, would
also be the act of a control freak. Providing both matches the spirit,
if not the exact circumstances, of Postel's Law (as at, for example,
<http://en.wikipedia.org/wiki/Postel's_Law>).

KETFOB.

BTW, I forgot to mention that there was no mention of acronyms in the
sig of that article of mine in which you falsely saw one. That should
have been a clue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top