422,946 Members | 1,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,946 IT Pros & Developers. It's quick & easy.

Unicode converter

P: n/a
Is there some Unicode converter to convert javascript to Unicode
format?

thanks
mistral

Jul 10 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
mistral wrote:
Is there some Unicode converter to convert javascript to Unicode
format?
JavaScript is just text, so anything that can read the format the JS is
encoded in and output Unicover.

iconv is a standard UNIX utility for doing this.

Jul 10 '06 #2

P: n/a
mistral wrote:
Is there some Unicode converter to convert javascript to Unicode
format?
I'm not sure what you mean by "converting" a javascript to Unicode.
Perhaps you need UTF-8 support for content of variables etc. Javascript
syntax itself does not require an Unicoded environment. It should be
okay from ISO-8859-1 and up (perhaps even ASCII).

I'ld say you can configure most code editors to save files as Unicode,
such as the ConText-editor (www.context.cx). So just setting such an
option when saving your js code should be sufficient.

--
Bart

Jul 10 '06 #3

P: n/a

David Dorward писал(а):

mistral wrote:
Is there some Unicode converter to convert javascript to Unicode
format?
JavaScript is just text, so anything that can read the format the JS is
encoded in and output Unicover.

iconv is a standard UNIX utility for doing this.
----------------------------------------------

Not find this encoder there.
I tried also ascii to unicode converter, which generate ready html
code; but not work:

<Script Language='Javascript'>
<!--
eval(unescape('%67%67%47%73%67%53%47%73%64'));
//-->
</Script>

and this:

<script
type="text/javascript">document.write('\u0076\u0061\u0072\u00 20\u0073\u0074\u0061\u0079\u003d\u0063\u006f\u006e \u0066\u0069\u0072\u006d\u0028\u0022\u0054\u0068\u 0065\u0020\u0066\u006f\u006c\u006c\u006f\u0077\u00 69\u006e\u0067\u0020\u006f\u006d\u0022\u000d\u000a ')</script>

both methods not work.

mistral

Jul 10 '06 #4

P: n/a

Bart Van der Donck писал(а):
mistral wrote:
Is there some Unicode converter to convert javascript to Unicode
format?
I'm not sure what you mean by "converting" a javascript to Unicode.
Perhaps you need UTF-8 support for content of variables etc. Javascript
syntax itself does not require an Unicoded environment. It should be
okay from ISO-8859-1 and up (perhaps even ASCII).
I'ld say you can configure most code editors to save files as Unicode,
such as the ConText-editor (www.context.cx). So just setting such an
option when saving your js code should be sufficient.
--
Bart
-------------------------------------------------------

I meant simple conversion utility (or some online script) which can
convert normal javascript code into Unicode, which will normally work
on a html page. I tried, but script does not work after conversion.

mistral

Jul 10 '06 #5

P: n/a
mistral wrote:
I meant simple conversion utility (or some online script) which can
convert normal javascript code into Unicode, which will normally work
on a html page. I tried, but script does not work after conversion.
By "Unicode" do you mean "Something which can't easily be read by people
with view source but the browser will still execute"? ... because that is
not Unicode. See http://www.jibbering.com/faq/#FAQ4_1 instead.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 10 '06 #6

P: n/a
mistral wrote:
Bart Van der Donck писал(а):
[...]
I'ld say you can configure most code editors to save files as Unicode,
such as the ConText-editor (www.context.cx). So just setting such an
option when saving your js code should be sufficient.

--
Bart
-------------------------------------------------------

I meant simple conversion utility (or some online script) which can
convert normal javascript code into Unicode, which will normally work
on a html page. I tried, but script does not work after conversion.
It's still not clear to me, sorry. You can view the source of that HTML
page, then set your Notepad to Unicode or UTF-8 (should be available on
WinXP) and then save the code. Alternatively, configure the browser to
use your favourite Unicode-aware editor for the View Source action.

Or do you mean something else ?

--
Bart

Jul 10 '06 #7

P: n/a
On 10 Jul 2006 10:04:59 -0700, mistral wrote:
both methods not work.
Mabe this could help:

// Copyright & author: Atamyrat Mary, Turkmenistan
// http://www.kanolife.com/escape/
function unicodeEscape (pstrString) {
if (pstrString == "") {
return "";
}
var iPos = 0;
var strOut = "";
var strChar;
var strString = escape(pstrString);
while (iPos < strString.length) {
strChar = strString.substr(iPos, 1);
if (strChar == "%") {
strNextChar = strString.substr(iPos + 1, 1);
if (strNextChar == "u") {
strOut += strString.substr(iPos, 6);
iPos += 6;
}
else {
strOut += "%u00" +
strString.substr(iPos + 1, 2);
iPos += 3;
}
}
else {
strOut += strChar;
iPos++;
}
}
return strOut;
}
Jul 10 '06 #8

P: n/a

Bart Van der Donck писал(а):

mistral wrote:
Bart Van der Donck писал(а):
[...]
I'ld say you can configure most code editors to save files as Unicode,
such as the ConText-editor (www.context.cx). So just setting such an
option when saving your js code should be sufficient.
--
Bart
-------------------------------------------------------

I meant simple conversion utility (or some online script) which can
convert normal javascript code into Unicode, which will normally work
on a html page. I tried, but script does not work after conversion.

It's still not clear to me, sorry. You can view the source of that HTML
page, then set your Notepad to Unicode or UTF-8 (should be available on
WinXP) and then save the code. Alternatively, configure the browser to
use your favourite Unicode-aware editor for the View Source action.
Or do you mean something else ?
--
Bart

I meant utility to convert the string of textual characters to their
respective Unicode values.
Then use the decryption function to decrypt the ciphertext bit string
to a readable string of textual characters(script). This reverse
conversion can be provided by built-in JavaScript methods, probably.

<script language="Javascript">
<!--
document.write(unescape('%3C%73%63%73%70%65%3D%22% 6A.....'));
//-->
</script>

Need utility ot script that do this direct conversion, and right
javascript method that do a reverse conversion, to allow a javascript
work correct.

Jul 11 '06 #9

P: n/a
RC
mistral wrote:
and this:

<script
type="text/javascript">document.write('\u0076\u0061\u0072\u00 20\u0073\u0074\u0061\u0079\u003d\u0063\u006f\u006e \u0066\u0069\u0072\u006d\u0028\u0022\u0054\u0068\u 0065\u0020\u0066\u006f\u006c\u006c\u006f\u0077\u00 69\u006e\u0067\u0020\u006f\u006d\u0022\u000d\u000a ')</script>

both methods not work.

This is work for me. There is no unicode coverter for JavaScript. The
unicode encoding is from your browser. I am using IE, FF (Firefox) and
NS (Netscape). The trick is <metatag
<html><head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>毛子</title></head>
<body>
Hello Mao Zi,
毛子

<br />
<script language="JavaScript">
document.write('\u0076\u0061\u0072\u0020\u0073\u00 74\u0061\u0079\u003d\u0063\u006f\u006e\u0066\u0069 \u0072\u006d\u0028\u0022\u0054\u0068\u0065\u0020\u 0066\u006f\u006c\u006c\u006f\u0077\u0069\u006e\u00 67\u0020\u006f\u006d\u0022\u000d\u000a');
</script>

</body></html>
Jul 12 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.