I know in ASCII '\r' is 0x0d,'\n' is 0x0a.
But some say ASCII characters in UTF8 is unchanged.
Now I want to know in UTF8 '\r' and '\n' are already 0x0d and 0x0a??
Could anybody can tell me? Very Thanks!!!!
Nov 14 '05
16 2748
Clark S. Cox III wrote: Lawrence Kirby <lk****@netacti ve.co.uk> said: On Thu, 17 Feb 2005 00:38:52 -0800, chunhui_true wrote:
I know in ASCII '\r' is 0x0d,'\n' is 0x0a.
Wasn't that the other way around on Macs?
No, the actual values of '\r' and '\n' are unchanged on the Mac.
Depends on the development tool and compiler settings.
Generally, most old mac implementations used the normal form, but at
least two offer(ed) the option of setting \r to 10 and \n to 13.
--
Peter
On Thu, 17 Feb 2005 13:59:00 -0800, Peter Nilsson wrote:
.... Metrowerks 3.0, Mac IIvx, swap \n and \r enabled...
\r = 10 \n = 13
The compiler option allows mac implementations to avoid having to perform runtime translations of text file end-of-lines.
So it is dangerous to assume that '\n' is 10 and '\r' is
13 even on an ASCII based system.
Lawrence
"chunhui_tr ue" <ch*********@gm ail.com> wrote:
# Does ASCII characters remain unchanged under UTF8????Since it
# unchanged,Why I can't printf thme in screen?
# I use libcap get the FTP commands from Ethernet.I have one class to
You're going to have to deal with the sources or authours for your software.
When your printing characters, the software is interpretting a subsequence of
bits as an index to a raster pattern or font character, and then painting that
on the screen or printer. Everybody has to agree where character divisions are
in the bit stream and how character codes are encoded. Or chaos ensues.
If you've got non-ASCII unicode characters in your UTF-8 stream, they will
show up as one or more non-ASCII characters. How the software deals with non-ASCII
characters depends on the software. It might mask off the high bit; it might
discard them; it might treat them similar to letters and digits. The software
might assume some other encoding like macintosh or windows and interpret
the non-ASCII codes as different characters then you wanted it to.
The same sort of confusion happened when 8-bit characters ousted 6-bit, but
at least then it was in smaller community.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Mention something out of a Charleton Heston movie, and suddenly
everybody's a theology scholar.
"Lawrence Kirby" writes: On Thu, 17 Feb 2005 13:59:00 -0800, Peter Nilsson wrote:
...
Metrowerks 3.0, Mac IIvx, swap \n and \r enabled...
\r = 10 \n = 13
The compiler option allows mac implementations to avoid having to perform runtime translations of text file end-of-lines.
So it is dangerous to assume that '\n' is 10 and '\r' is 13 even on an ASCII based system.
I don't agree with that. K&R, p 193, says carriage return is \r. In ASCII,
carriage return is 13. So a platform that says \r = 10 is simply not ASCII.
I haven't been following this thread so it may be that what you *mean* is
true, but the literal meaning of the your post is simply wrong as I see it.
I think the thing actually being discussed has to do how various platforms
handle the \n problem in a non \n world, i.e., ASCII as originally
promulgated. And I agree that assumptions WRT \r and \n and what they
*do* are dangerous.
osmium wrote: "Lawrence Kirby" writes:
On Thu, 17 Feb 2005 13:59:00 -0800, Peter Nilsson wrote:
...
Metrowerks 3.0, Mac IIvx, swap \n and \r enabled...
\r = 10 \n = 13
The compiler option allows mac implementations to avoid having to perform runtime translations of text file end-of-lines. So it is dangerous to assume that '\n' is 10 and '\r' is 13 even on an ASCII based system.
I don't agree with that. K&R, p 193, says carriage return is \r. In ASCII, carriage return is 13. So a platform that says \r = 10 is simply not ASCII.
Please, make that '\r' and '\n' vs <CR> and <LF>. C does not care about
the character encoding it works with. If there is a "non-ASCII" platform
which has a different binary representation (maybe including multiple
bytes) of such an escape sequence, '\r' and '\n' still are carriage
return and newline, respectively.
If I use your reasoning then only Unix text files are ASCII files
because only they use <LF> as newline encoding.
BTW: The only thing _I_ rely on if hearing ASCII is that
0x20 through 0x7F will represent the printable characters I am used to.
Cheers
Michael I haven't been following this thread so it may be that what you *mean* is true, but the literal meaning of the your post is simply wrong as I see it. I think the thing actually being discussed has to do how various platforms handle the \n problem in a non \n world, i.e., ASCII as originally promulgated. And I agree that assumptions WRT \r and \n and what they *do* are dangerous.
--
E-Mail: Mine is a gmx dot de address.
Michael Mair wrote:
[snip] BTW: The only thing _I_ rely on if hearing ASCII is that 0x20 through 0x7F will represent the printable characters I am used to.
ITYM 0x20 through 0x7E will represent the printable characters you are
used to. ASCII 0x7F is a 'control character', the 'DEL' (delete) control
character to be precise.
But, IKWYM
--
Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFCFgyfagV FX4UWr64RAoLIAJ 9guTivNQ+5Y6utz 8q0SdY9fKB06wCg kYId
4OtpbKa3WU/PnsqiXGvhwtU=
=5XQX
-----END PGP SIGNATURE-----
Lew Pitcher wrote: Michael Mair wrote: [snip]
BTW: The only thing _I_ rely on if hearing ASCII is that 0x20 through 0x7F will represent the printable characters I am used to.
ITYM 0x20 through 0x7E will represent the printable characters you are used to. ASCII 0x7F is a 'control character', the 'DEL' (delete) control character to be precise.
Yes, that is what I meant... Thanks for the correction.
But, IKWYM
:-)
Cheers
Michael
--
E-Mail: Mine is a gmx dot de address. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: DraguVaso |
last post by:
Hi,
For my SMS-application I need to be able to send characters with accents
(like é and à). But this doesn't seem to work in Text Mode, so i will need
to do it in PDU Mode.
Does anybody has soem converting routines for that in VB.NET? I need my text
to be converted to a PDU-message, and back (for received messages).
Thansk in advance,
|
by: chunhui_true |
last post by:
i have a class, it can read one line(\r\n ended) from string,when i
read line from utf8 string i can't get any thing!
maybe i should conversion utf8 to ascii??there is any function can
conversion utf8 to ascii? very thanks to your help!!
|
by: Dan V. |
last post by:
How do I create a one line text file with these control codes? e.g.: 144 =
0x90 and 147 = 0x93?
I am trying to create a one line text file with these characters all one one
row with no spaces.
1. 144 = 0x90
2. 147 = 0x93
3. STX = (^B = 2 = 0x2)
4. NUL = (^@ = 0 = 0x0)
|
by: Friso Wiskerke |
last post by:
Hi all,
I'm creating a fixed length textfile with data which is sent out to a
third-party which in turn reads the file and processes it. Some of the
characters are not part of the lower ASCII table. This causes problems
because an È (&HC4) in the textfile is converted into 2 bytes on the
receiving end which then in turn shifts the remaining data on the line one
byte to the right... and in a fixed length textfile that's a disaster
Is...
|
by: Hooyoo |
last post by:
I read the content from a file encoded with UTF8 like this:
byte data = binaryReader.ReadBytes(file.Length);
And next step, I want to transform data to ASCII format, How can I do
this?
You know, Using Encoding.UTF8.GetString(data) can get a ASCII string,
but I need a byte.
I hope you get my point. Any suggestion will be appreciated.
| |
by: silverburgh.meryl |
last post by:
Hi,
Is there a string function to trim all non-ascii characters out of a
string?
Let say I have a string in python (which is utf8 encoded), is there a
python function which I can convert that to a string which composed of
only ascii characters?
Thank you.
|
by: =?Utf-8?B?YXVsZGg=?= |
last post by:
i have come across a situation in my project where i read a text file with
some characters greater than hex 0x7f.
i need to write character (0xE0) to a new file as an exception. however when
i attempt to write this via "Console.Write" or "filestream.Write" it seems
the value changes. most of the output file is in text mode.
if i view the original file in binary mode i see the character i'm having
issue with as "e0 00" but when i...
|
by: aagarwal8 |
last post by:
Hi,
I want to display the extended ASCII charset in the list view (in List
mode), but when i assign any of the Ex. ASCII chars to the listview
item text, it renders blank.
Any idea how i can display the Ex ASCII chars in list view.
Regards,
Ankit!!
|
by: kettle |
last post by:
Hi,
I was wondering how I ought to be handling character range
translations in python.
What I want to do is translate fullwidth numbers and roman alphabet
characters into their halfwidth ascii equivalents.
In perl I can do this pretty easily with tr:
tr/\x{ff00}-\x{ff5e}/\x{0020}-\x{007e}/;
|
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,...
|
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: 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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |