473,404 Members | 2,174 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,404 software developers and data experts.

Unicode String Constants

I am trying to make a bunch of unicode constant strings. I am trying
the following without success. Below is an example. Bad means that I
get the following error "unclosed string literal". Is this due to the
fact that 22hex is the ascii 34 double quote character? If so how do
i work around?

Note: They are not for display, they are for commands to be sent to a
server.

protected final static String CD0 = "", //OK
CD1 = "\u0000\u0001", // OK
CD2 = "\u0002\u0004", // OK
CD3 = "\u0002\u0012", // OK
CD4 = "\u0002\u000c", // OK
CD5 = "\u0002\u0022", // BAD
CD6 = "\u0002\u00c0"; // OK
Jul 17 '05 #1
2 13701
Hi,
When we are using unicode escape in the program, there is a
process which translates this unicode escape characters before the
compilation. Due to the fact that CD5 is translated as """ which is a
illegal, so you have to escape the " character by writing it as "\"".
So I think CD5 should be "\u0002\u005c\u0022". Hope this can help you.

Benny

bd****@comcast.net (B Dring) wrote in message news:<a4**************************@posting.google. com>...
I am trying to make a bunch of unicode constant strings. I am trying
the following without success. Below is an example. Bad means that I
get the following error "unclosed string literal". Is this due to the
fact that 22hex is the ascii 34 double quote character? If so how do
i work around?

Note: They are not for display, they are for commands to be sent to a
server.

protected final static String CD0 = "", //OK
CD1 = "\u0000\u0001", // OK
CD2 = "\u0002\u0004", // OK
CD3 = "\u0002\u0012", // OK
CD4 = "\u0002\u000c", // OK
CD5 = "\u0002\u0022", // BAD
CD6 = "\u0002\u00c0"; // OK

Jul 17 '05 #2
Why don't you use a char array?

char CD5[] = {'\u0002','\u0022'};

This should work.
Jul 17 '05 #3

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

Similar topics

8
by: Ivan Voras | last post by:
When concatenating strings (actually, a constant and a string...) i get the following error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in position 1: ordinal not in range(128) ...
8
by: Francis Girard | last post by:
Hi, For the first time in my programmer life, I have to take care of character encoding. I have a question about the BOM marks. If I understand well, into the UTF-8 unicode binary...
19
by: Svennglenn | last post by:
I'm working on a program that is supposed to save different information to text files. Because the program is in swedish i have to use unicode text for ÅÄÖ letters. When I run the following...
1
by: John Hall | last post by:
We need to read a SQL database containing a mix of English words and Chinese Characters. We think we need to use the N'xxxx' to read the Unicode. We have one place where the SELECT statement...
9
by: William Cruz | last post by:
How can I access these unicode symbols & show them thru my application. Thanks. http://www.unicode.org/charts/PDF/U2200.pdf William Cruz *** Sent via Developersdex...
12
by: manstey | last post by:
I am writing a program to translate a list of ascii letters into a different language that requires unicode encoding. This is what I have done so far: 1. I have # -*- coding: UTF-8 -*- as my...
8
by: Richard Schulman | last post by:
The following program fragment works correctly with an ascii input file. But the file I actually want to process is Unicode (utf-16 encoding). The file must be Unicode rather than ASCII or...
15
by: luc.saffre | last post by:
Hello, here is something that surprises me. #coding: iso-8859-1 s1=u"Frau Müller machte große Augen" s2="Frau Müller machte große Augen" if s1 == s2: pass
4
by: billsahiker | last post by:
Where do I find the unicode values for math operators like equal, minus and plus sign and how to I check if the value of a byte array is one of these operators? I populate the byte array from a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.