I'm trying to convert UCS-2 code to ASCII. Does anyone have an example in
C?.
thanks. 4 10208
test wrote: I'm trying to convert UCS-2 code to ASCII. Does anyone have an example in C?.
for( i=0; i!=len; ++i)
if( (ucs2[i]>=0) && (ucs2[i]<127))
ascii[i] = ucs2[i];
else
conversion_fail ed();
ascii[i] = '\0';
Yes, not all UCS-2 can be converted to ASCII.
Yes, character code 127 is not part of ASCII.
Uli
On 2005-02-22 01:05:39 -0500, Ulrich Eckhardt <do******@knuut .de> said: test wrote: I'm trying to convert UCS-2 code to ASCII. Does anyone have an example in C?.
for( i=0; i!=len; ++i) if( (ucs2[i]>=0) && (ucs2[i]<127)) ascii[i] = ucs2[i]; else conversion_fail ed(); ascii[i] = '\0';
Yes, not all UCS-2 can be converted to ASCII. Yes, character code 127 is not part of ASCII.
[OT]
According to ISO-646 and ISO-10646, character 127 is the "DEL" control
character, and is indeed part of both ASCII and Unicode.
[/OT]
--
Clark S. Cox, III cl*******@gmail .com
# Yes, character code 127 is not part of ASCII.
Rubout character.
In the good old days of paper tape, you couldn't remove a mistake. Instead you
backed up and punched all columns. The resulting all ones code (31, 63, 127, or
255) was a signal that character position was supposed to be ignored.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
OOOOOOOOOO! NAVY SEALS!
On Tue, 22 Feb 2005 19:03:26 -0000,
SM Ryan <wy*****@tang o-sierra-oscar-foxtrot-tango.fake.org> wrote: # Yes, character code 127 is not part of ASCII.
Rubout character.
In the good old days of paper tape, you couldn't remove a mistake. Instead you backed up and punched all columns. The resulting all ones code (31, 63, 127, or 255) was a signal that character position was supposed to be ignored.
That was, by the way, 127 plus even parity on 8 channel paper tape.
Villy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Oleg Leschov |
last post by:
Where can I find a list and documentation for codecs?
What I want to do is to make a unicode string out of unicode data.
for example. I am parsing NTFS metadata, that contains filenames as
UCS-2 code, so I have a binary string that pretends to be a UCS-2.
Currently I am using hand-written module, a wrapper to iconv library, to make
translation of this data (that is, I used it for that task).
However, I am aware of python's codecs that are...
|
by: wael |
last post by:
hello all,
i want convert w_char to UCS2 encoded (0041) this is a char encoded UCS2
please look at this
http://www.unicode.org/charts/
http://www.unicode.org/
every language has a chart
bye example
char 'A' = 0041--> (UCS encoded)
|
by: panda |
last post by:
Dear ALL,
How can I create an database of codepage UTF-16/UCS-2 in AIX DB2 V8?
I tried to use "db2set db2codepage=1200" and "db2 terminate" but
failed. I also tried to use "db2 create db abc using codeset UTF-16
territory US" but also failed. What are the steps? Do I need to install
additional locale on AIX?
Thanks.
|
by: Bill |
last post by:
I've having a very strange problem.
In a large solution it may occur only on 30-40% of the projects that include
Forms/UserControls.
I design the form at design-time, justify the controls etc.
But at runtime they get inflated in width! (they become about 20-25% larger
in width).
Seems like a serious bug, but i can't find the source that's causing the
problem...
|
by: beni.cherniavsky |
last post by:
Python seems to be missing a UCS-32 codec, even in wide builds (not
that it the build should matter).
Is there some deep reason or should I just contribute a patch?
If it's just a bug, should I call the codec 'ucs-32' or 'utf-32'? Or
both (aliased)?
There should be '-le' and '-be' variats, I suppose. Should there be a
variant without explicit endianity, using a BOM to decide (like
'utf-16')?
And it should combine surrogates into...
| |
by: Anthony Baxter |
last post by:
SECURITY ADVISORY
Buffer overrun in repr() for UCS-4 encoded unicode strings
http://www.python.org/news/security/PSF-2006-001/
Advisory ID: PSF-2006-001
Issue Date: October 12, 2006
Product: Python
Versions: 2.2, 2.3, 2.4 prior to 2.4.4, wide unicode (UCS-4) builds only
CVE Names: CAN-2006-4980
|
by: Boris |
last post by:
I'm trying to find out what the steps look like to upgrade a program
(which is used on Windows and Unix) from Windows-1252 (the Windows "ANSI"
code page) to UCS-2. Currently the program reads and writes files encoded
in Windows-1252 but should be able to read files encoded in UCS-2, too.
As I don't want to deal with two character representations in the program
I plan to use UCS-2 internally. I should be able to simply use
std::wstring...
|
by: ajibits |
last post by:
hi ppl
For my application, I need to encode/decode the information in either of these two following coding schemes.
Contents:
Alpha tagging(name) of the associated dialling number.
Coding:
|
by: Jeffrey Walton |
last post by:
HI All,
I' working on an ASN.1 parser. The Content Octets (data values) are
stored in a byte. The conversion of byte to char is fairly
trivial. BMP is a special case of UCS, using the lower 65 thousand
characters. Reference http://en.wikipedia.org/wiki/Universal_Character_Set#Encoding_forms_of_the_Universal_Character_Set
How do I specify a character set of UCS (ISO/IEC 10646) when invoking
a string constructor?
|
by: sm0a9f4 |
last post by:
Hi everyone,
I'm a noob with a problem...
In non-IE browsers, I'm trying to load a UCS-2 (UTF-16) encoded file using the following lines:
xmlDoc=document.implementation.createDocument("settings.xml","",null);
xmlDoc.async=false;
xmlDoc.load("");
I get an error on the last line that says "Value Undefined (result expression xmlDoc.load) is not an object."
1.) Do I have to specify an encoding type when loading a an XML file? (There...
|
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...
| |
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...
|
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |