473,811 Members | 3,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unterminated string literal

Hi All,

I am using "C" to generate the javascript code. And i am getting the
following error message "Unterminat ed string literal" in the mozilla
webbrowser for the following syntax.

unsigned char *Buf="Test"

printf("alert(\ "%s\");\n\n",Bu f);

I see an error message alert("Test Unterminated string literal in the
Javascript console of Mozilla web browser.

Nov 14 '05 #1
1 4677
In article <11************ **********@l41g 2000cwc.googleg roups.com>,
<va*****@agilis .st.com.sg> wrote:
I am using "C" to generate the javascript code. And i am getting the
following error message "Unterminat ed string literal" in the mozilla
webbrowser for the following syntax. unsigned char *Buf="Test" printf("alert( \"%s\");\n\n",B uf); I see an error message alert("Test Unterminated string literal in the
Javascript console of Mozilla web browser.


I take it this is intended to be the C code that runs within the
context of a CGI script that will send output to a browser?

You are missing the semicolon after the declaration line.

One variation you could experiment with is to use

printf("alert(' %s');\n\n",Buf) ;

Either way, in the general case unless you know that
the contents of Buf is safe, you should pass it through a routine
to escape any quote-marks it has internally.
--
Ceci, ce n'est pas une idée.
Nov 14 '05 #2

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

Similar topics

5
5721
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 appears to occur right after type='+typeIn+'&id <----before the = Any clues appreciated! Thanks, Kathy
2
7216
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 - /usr/local/psa/admin/htdocs/domains/databases/phpPgAdmin/db_readdump.php -- Line: 33 PostgreSQL said: ERROR: parser: unterminated quoted string at or near "'Black Tea\015\012Fresh range of leaf tea for drinking black or with
3
4115
by: aroraamit81 | last post by:
Hi, I am facing a problem in javascript. strdata is a variable of javascript and following is an assignment( hmmmmmmmmmmm a Huge one but unfortunately its not mine code, I am just trying to rectify it) to this varibale.. Now I am facing a run time error(Unterminated string constant). Can any one please help me solving this bug. strdata +="<tr <% if functionality_add = 0 and functionality_edit = 0
2
16920
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, allso avant browser (shell for IE) dosent see it. the script works fine, i'm just anoyed with IE calling errors. Anybody know why this is?
1
7996
by: larrylyons | last post by:
I don't understand why I'm getting Unterminated String Literal error MY JAVASCRIPT function test(){ newWindow = window.open("","","scrollbars,resizable,height=300,width=200,top=5,left=50",align='center'); newWindow.document.write( "<html><head><title>The Title</title></head>") newWindow.document.write( '<body bgcolor="#ffffcc" onBlur="window.close()"') newWindow.document.write("<BR>This is a test<BR>")
7
25208
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 JavaScript error: "Unterminated string literal". This happens only in one case. If you noticed ASP variable <%=ID%>, then here's what happens to it. ID gets url parameter "id" and inserts in that JavaScript. Obviously, this URL comes from another...
7
5721
basstradamus
by: basstradamus | last post by:
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()?
0
1898
by: manojpolawar2008 | last post by:
Hi, I am using the fckeditor with asp.net2.0. I have declared and initialized and the FCKEditor on code behind(ie on aspx.vb) page. and i wan to set the ViewState value to FckEditor on .aspx page in Javascript function. for that i have used SetHTML() or value. but it showing error. ERROR- unterminated string literal. in firefox and IE also.
0
9724
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7665
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.