Escape() Behaves Strange Sometimes

May 12, 2007

Yesterday I discovered a problem on one of my sites: escape function was encoding the same string Sal in two different ways:Sal%F2Sal%C3%B2
This was happening on Firefox 2.0.0.3. In Opera 9.20 was encoded ok every time.

So, in Firefox was a russian roulette . Sometimes was encoding the string like I wanted to, sometimes not. As a solution I use encodeURIComponent(), but the behavior of escape() seems strange to me.

View 7 Replies


ADVERTISEMENT

Encode() Behaves Differently With Different Charsets?

Jul 20, 2005

I've recently come upon an odd Javascript (and/or browser) behavior, and after hunting around the Web I still can't seem to find an answer.

Specifically, I have noticed that the Javascript encode() function behaves differently if a codepage has been set.

<script>
document.write(escape(''));
(note: that should be five accented characters)
</script>

Produces: %D4%E8%EB%EC%E8

But setting the codepage to Windows-1251:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=Windows-1251">
<script>
document.write(escape(''));
</script>

Produces: %u0424%u0438%u043B%u043C%u0438

Personally, I wouldn't expect the Javascript encode() function to change its behavior if the codepage has been changed.

Might you know of any resources that can help me better understand what's happening there?

View 5 Replies View Related

IE Behaves Differently For Dynamic Form.

Jan 27, 2008

I'm trying to make a dynamic form, where I want to add/remove a set of controls (say for Name,Email etc).

Just started but IE behaves differently that FF in the beginning itself. "Add more" works but "Remove this" doesn't. Also the CSS for dynamically created elements doesn't work. Here is my code so far. Code:

View 20 Replies View Related

Window.location.reload Behaves Randomly?

Aug 6, 2010

i am invoking window.opener.location.reload function from a pop up window to reload the parent page. But this seems to behave randomly. Sometimes the reload would preserve form data eg. the state of the drop down lists. On some other occasions, it would reset all the drop down lists and form data. Does window.location.reload resend form data to the server?

View 1 Replies View Related

Strange Encoding

Jul 23, 2005

It's the first time I read the following code.
A few js files like the one below, but I don't know how to make them
readable by a human ( me ).

Is it a strange character set ? an obfuscation ? both ?
Firefox or IE detects no errors, so the following code is run with no
problem.

View 4 Replies View Related

Base64 Strange

May 14, 2007

I'm trying to send a byte array (JPG image) from javascript to a servlet for processing. I'm using Base64 to encode the byte array in javascript, and then a base64 decoder in the servlet to decode it.

The thing is, that even though the String has the same length on both sides, the decoded byte array is shorter then the original one. I've tried a couple of different implementation on both sides, with the same results.

View 4 Replies View Related

Strange Behaviour

Mar 17, 2006

Dont know how to put this. In my application i had one jsp where i did some modifications in the java script function and increased the maxlength of a field.

Just these two major modifications i did.But strangely everything got screwed up the function is not being called and many other java scripts func are not being called. Many buttons are not behaving strangely. That jsp is a very big one and a part of a major colossal application so i am not pasting it.

View 1 Replies View Related

Escape Character & And #

Jul 23, 2005

Does anyone know the escape character for & and # like in :
Update GDO_INFO_ER set V_COMMENTAIRE='B&A' where V_USERMODIFICATION='bilal123'
or
Update GDO_INFO_ER set V_COMMENTAIRE='B#A' where V_USERMODIFICATION='bilal123'
I would like to insert & and # literally in the table.

View 2 Replies View Related

Javascript Escape

Jul 20, 2005

I have some javscript mixed into a applications templating and have
run into a problem the way javascript is handling a path for me.

I am via the template assigning a file path to a javascript variable.

The Tempalte: var myfile = "!FILEPATH!";
which becomes: var myfile = "C:mydir hefile.txt";

The issue of course being that the 's are not escaped. I'm not as
fluent in Javascript as I'd like to be yet and I havn't figured out a
way to escape it so I can coninue on with the rest of the script.
I've tried to do a search and replace but javscript is already
interpreting the 's as escaping a character.

How can I either autoescape the 's (if possible), or access the raw
data so I can replace with ?

View 2 Replies View Related

Escape Char

May 24, 2006

How can I put this: document.write(window.name); where _______

in this statemant HMTL:
....
<td><a href="#" onclick="myInput_1f('_________', 'COMMESSA', '<? echo $mar->CODICE_COMMESSA; ?>')"><? echo $mar->CODICE_COMMESSA; ?></a></td>

....

View 3 Replies View Related

Double Escape

Jan 14, 2007

I am having trouble with some code on my site. I have an arcade with game links that have tooltips which display thumbnails. The tooltip code for each link is in the title attribute. I am using javascript to write the code for these links with tooltips so that if javascript is disabled the title attribute displays something different. My problem is some of the tooltip thumbnails contain an apostrophe (') in their src code. I use a backslash () to escape this once but I need to escape it again. Is this possible. The reason I need to escape it twice is one to escape it from the javascript and another to escape it from the src tag (src='Thumbs/image'src.jpg').

View 11 Replies View Related

Escape Apostrophy In URL

Jul 14, 2011

I have an announcement webpart on my sharepoint site. The boss wanted attachments to open in a new window so that users don�t close the attachment and get knocked from the site only to have to login again. To achieve this we settled on a policy that attachments should be in the form of PDF documents rather than word format. We contacted Microsoft who in turn developed a solution for us that consisted of a content editor web part that runs some javascript. The problem is 2 fold.

1. The javascript only works in Internet explorer. When used in other browsers the attachments open in the same window.

2. If the name of the document contains an apostrophe, IE barks a javascript error: expected �)�

How do I rewrite the code to escape the apostrophe and to function in multiple browsers?

<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("OpenPDFInNewWindow()");
function OpenPDFInNewWindow()
{

[Code].....

View 8 Replies View Related

Strange Firefox And IE Work

Dec 26, 2006

I have the following algorithm

1. Show message DIV

2. Long Loop Function

3. Hide message DIV

Opera shows DIV well. Firefox and IE don't show the DIV.
If to rewrite the algorithm like this Firefox and IE will show DIV

1. setTimeout(Long Loop Function,500)
2. Show message DIV

I also tried to debug the first algorithm in Firebug, and in step by
step mode I see that Firefox shows the DIVs.

Is it standart behaviour? What prevents browsers from showing the DIV?

View 1 Replies View Related

Handling Maths In Strange Way?

Aug 25, 2010

I have javascript calculating the total price of all the products in a shoppping cart. The prices are in the format of 10.99 or 5.50 or 10 ete.g if there are five items bought for 10.99 and 1 bought for 10, the script will multiply 10.99 by 3, then multiply 10 by one, then add the two results.

The resulting number is sometimes right, but quite often it ads an extra '000000002' or so to the amount??

[Code]...

View 3 Replies View Related

Strange 403 Error With New Window

May 17, 2006

I've used the following simple javascript in a link to open a new window:

<a href="javascript:void(0)" onclick="window.open('images/tshirtback.jpg','TShirtBack','width=540,height=660')">

This works and does as intended in all browsers other than (you've guessed it) MS IE wherby a 403 Forbidden error is generated. Anyone got any idea why this is the case and how I can get around it?

View 2 Replies View Related

Escape Colon In Script?

Nov 16, 2010

How do you escape a colon in JavaScript? I've tried several fixes (backslashes, hexadecimal code) and no luck.

View 4 Replies View Related

Submit The Escape Control?

Jan 20, 2011

I Have form use javascript to do th basic validation , but some how some one can get out of the javascript validation and submit the form why and how to stop it ?

<input type="button" name="Apply" value="Submit" onClick="if(checkForm()){javascript:document.apply.submit();};">

View 1 Replies View Related

Check Checkbox Strange Problem

Dec 27, 2006

I have a program that creates dinamically a web page. In the page I have the following function to check how many checkbox are checked.

function tarInfo(info) {
var i=0;
var c=0;
var l=document.forms[0].selected_files.length;
alert(l);
for (i=0; i<document.forms[0].selected_files.length;i++) {
if (document.forms[0].selected_files[i].checked) {
c++
}
}
..
..

The problem is that if I have only one checkbox, the alert(l) write
undefined. If I have more than 2 checkbox, the function works well.
Here a part of the webpage with one checkbox.

<form name="form1" action="filemanager" method="POST"
enctype="multipart/form-data" >
..
..
<td>
<input type="checkbox" value="pbsrun.o100"
name="selected_files">
</td>
..
..
<input type="submit" class="button" name="tar" value="Tar"
tarInfo('tar')">

Where is the problem?

View 9 Replies View Related

Strange Behavior When Changing Select's Value

Jul 20, 2005

I expect to see "foo" for the 2nd alert. Instead, the value of select is
cleared. Am I missing something?

<html>
<head><title>Foo</title>
<script language="javascript">
<!--
function foo()
{
alert('Before change: ' + document.control.titleFont.value);
document.control.titleFont.value = 'foo'
alert('After change: ' + document.control.titleFont.value);
}
-->
</script>
</head>
<body>
<form name="control" method="POST">
<select name="titleFont">
<option value="sans-serif">Arial</option>
<option value="serif">Times</option>
</select>&nbsp;
<input type="submit" name="control" value="Submit" onclick="return
foo()"/>
</form>
</body>
</html>

View 1 Replies View Related

Strange Results When Submittng Form / Fix It?

Sep 14, 2009

I have a form that is submitted via jquery into a mysql database using php code...

View 1 Replies View Related

Strange Behaviour In Window.prompt()?

Dec 6, 2010

I have been working with with window.promt() and i noticed a weird behaviour.In some cases (i do not known why) my prompt cannot get over a certain limit of characters. But in some other cases it can get as many characters as i want.

View 7 Replies View Related

Unicode Escape Non-ascii Chars?

Jan 1, 2009

I'm looking for a function that will convert non-ascii characters to unicode escaped string.For example, "あ" => "u3042".A similar piece of code is below. However, it convert strings to "\uxxxx" instead of "uxxxx". Changing "\" to "" in code below still won't work because that result in 'u' + 'xxxx' which print as "uxxxx".I have been searching for a few days already, and start wondering if this is at all possible. ; (

Code:
var unicodeEscape = function(str) {
var code, pref = {1: '\x0', 2: '\x', 3: '\u0', 4: '\u'};

[code]....

View 8 Replies View Related

Strange Thing Happening With Onunload And Google

Jul 23, 2005

I have set up a disclaimer page for our public access PCs at our Libraries which has the following function:

function breach() {
alert("Proceeding beyond these Conditions is..................... If you have read the Conditions, scroll to the bottom and press the 'Yes I

agree' button.")
window.location="disclaim.htm"

and then in the body tag I have onunload=breach()
This works fine for all websites entered into the address bar except if

you enter www.google.com

What it is supposed to do is bring up the prompt and when you click on the OK button it will go back to the disclaimer page. They should only be able to get to the web by clicking on the 'Yes I
agree' button at the bottom of the disclaimer page. Does anyone out there know why google doesn't fire up the disclaim.htm page like all the other sites? It is very frustrating.

View 1 Replies View Related

JQuery :: Strange Incomplete Page Loaded?

May 18, 2011

We use WebSphere 6.1 as web server and the project is in ear file. After deployment, sometimes access server, the page was load incomplete, such as logo image (.gif) disappeared, and JavaScript error appeared. But after press on Refresh button from browser (IE), the page is loaded completed, all images are loaded and the JavaScript is gone.

[Code]...

We have tried to optimize the JSP page, however the page loaded is faster but this issue still occurred once in a while. Does anyone encounter the same issue before?

View 2 Replies View Related

JQuery :: Get A Strange Error Called:00ce56e?

Feb 4, 2010

This is a support ticket, stating the fact if that IE not support the characte encoding or somehow misinterprets the encoding you will get a strange javascript error called:00ce56e.This will apply on all your ajax transfers for one.For example i had a text/html;charset=utf8 header returned from a php-webservice i wrote. Nice i though, charencoding is the "plant-shit" (Crank quote) and code along and thought to myself, "Damn i'm a witty one". until i started the "IE" beast.. the beast throw out all my claims and the lookout for actually winning this went down. Until i found the above URL.. That is some crackhed shit right there. (Crank anyone?!).What it's stating more or less is that if IE 7 or 8 (or any program that uses whatever that is located in what dll) would more or less shit its pants when it run over an unspported encoding.. In this case UTF-8..

Ok, i'm a swedish guy and uses windows iso latin craptastic charsets more or less everyday but when coding for internationally webpages that are targeting multiple countries you cant get to be staring blindly at your own chars by altering my header to a text/html instead of a text/html;charset=utf8 response to my ajax script i solved alot of strange error shit. (but not my previous post with the fact that IE dont succed even if it would want to, thats a total other question but related but not directly if you get my drift.)..

View 1 Replies View Related

Strange Unterminated String Literal Error

Dec 22, 2007

I can't find anything wrong with this code <!-- Initialise the editor --><script>
initRTE('<table align="" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr></tr></tbody></table>', 'example.css');
</script>

However this throws an error in firebug and the page doesn't display it correctly, i get an error in firebug

unterminated string literal
initRTE('<table align="" border="0" cellpadding="0" cellspacing="0" widt...
Does anyone have and idea whats going on?

View 16 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved