473,396 Members | 1,773 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,396 software developers and data experts.

Unterminated string constant error above 70 000 chars

basstradamus
Hi
When I am trying to eveluate object literal It causing Unterminated string constans error (firefox).

var obiekt = (eval("("+data+")"));
the data is carring object literal recived from server (AJAX - JSON format)

It works normaly for smaller strings, but when data variable has about 20 000 chars there is an error.

Is there any limitations to string lenght that will be evaluated by eval()?

How can I fix that ?
Thanks
Apr 16 '07 #1
7 5694
mrhoo
428 256MB
unterminated string constant means it read an escape '\' with no following character.

Using javascript's eval to parse 70 kilobytes is a little like riding a kid's tricycle in the tour de france. It is hard to believe you can't move some of that data in another way.
Apr 17 '07 #2
Hi,
Thanks.

I've visit www.json.org and I found piece of javascript code to decode JSON. It works perfectly even up to 500 000 (it is definitly enought:)) chars.

basstradamus
Apr 17 '07 #3
Hi guys,
Could you tell me please how can I eval expression in javascript that contains \n character?
Jan 22 '09 #4
acoder
16,027 Expert Mod 8TB
Firstly, make sure you even need eval. If you do, then escape the \ character by doubling it.
Jan 22 '09 #5
thakim
2
basstradamus, can you please share the js piece that you used? I am having the same issue when the response is greater than the set character length. Thanks!
Dec 14 '11 #6
Dormilich
8,658 Expert Mod 8TB
visit the link he gave, you'll find the JSON library for JavaScript there.
Dec 15 '11 #7
thakim
2
Dormilich,

I clearly understand that there are a couple of JSON libraries on the link he provided. I was asking for the particular snippet that he used. Thanks for your reply though. I sent him a a separate message.

T
Dec 15 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: noViagraHere | last post by:
What do i need to add to the document line to stop getting an Unterminated String Constant error? itemtocheck = '1300'; document.writeln('<!--#include...
5
by: KathyB | last post by:
Hi, this is the first lines of a function. Although it runs, it still throws an "Unterminated string constant" error in the browser. It is all in one line, just wouldn't fit here. The error...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
1
by: vanitha | last post by:
Hi All, I am using "C" to generate the javascript code. And i am getting the following error message "Unterminated string literal" in the mozilla webbrowser for the following syntax. unsigned...
2
by: Daniel Secomb | last post by:
Hi, I'm using PostgreSQL 7.3.4 on phpPgAdmin 2.4.2 and I'm getting the following error when I try and run a SQL query on a script: Error -...
18
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further...
2
by: polilop | last post by:
When i open my page in IE it shows an error Unterminated string constant om Line..... When i look at the line it shows the line where the </SCRIPT> tag is ???? Moziila dose not see this error,...
7
by: vunet.us | last post by:
I have a function to open new window: function bla(){ newwin = window.open("page.asp?file=1&id=<%=ID %>","Image","other params") } This function works fine mostly, but sometimes, there is a...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.