473,608 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get 3 chars before <?xml version...

Hi;

My code is:

XmlDocument doc = new XmlDocument();
doc.AppendChild (xmlDoc.CreateX mlDeclaration(" 1.0", "UTF-8", ""));
....
doc.Save(outStr eam);

And my saved document has:
0xef 0xbb 0xbf before the <?xml...

What do I have to do to eliminate this? (.net 2.0)

--
thanks - dave
Nov 12 '05 #1
5 1128
Hello!
XmlDocument doc = new XmlDocument();
doc.AppendChild (xmlDoc.CreateX mlDeclaration(" 1.0", "UTF-8", ""));
...
doc.Save(outStr eam);

And my saved document has:
0xef 0xbb 0xbf before the <?xml...

What do I have to do to eliminate this? (.net 2.0)


Why do you want to do it?
AFAIK that's the Unicode Byte-Order-Marks wich every XML parser should
be able to understand.

Maybe a solution would be to switch to another encoding (US-ASCII,...)
--
Pascal Schmitt
Nov 12 '05 #2
I learn something new everyday - I was not aware of this. How long has this
been part of the standard?

--
thanks - dave
"Pascal Schmitt" wrote:
Hello!
XmlDocument doc = new XmlDocument();
doc.AppendChild (xmlDoc.CreateX mlDeclaration(" 1.0", "UTF-8", ""));
...
doc.Save(outStr eam);

And my saved document has:
0xef 0xbb 0xbf before the <?xml...

What do I have to do to eliminate this? (.net 2.0)


Why do you want to do it?
AFAIK that's the Unicode Byte-Order-Marks wich every XML parser should
be able to understand.

Maybe a solution would be to switch to another encoding (US-ASCII,...)
--
Pascal Schmitt

Nov 12 '05 #3
David Thielen wrote:
I learn something new everyday - I was not aware of this. How long has
this been part of the standard?


Since the very beginning. The WD-xml-961114 draft says (4.2.3):

"Entities encoded in UCS-2 must begin with the Byte Order Mark
described by ISO 10646 Annex E and Unicode Appendix B (the ZERO
WIDTH NO-BREAK SPACE character, U+FEFF). This is an encoding
signature, not part of either the markup or character data of
the XML document. XML processors must be able to use this
character to differentiate between UTF-8 and UCS-2 encoded
documents." [p.20]

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Nov 12 '05 #4
David Thielen wrote:
I learn something new everyday - I was not aware of this. How long has this
been part of the standard?


I don't know...
But it's not directly part of XML - it's part of the Unicode-Standard
(and since XML 1.0 is based on Unicode 2.0, it must be older than this...)

The 3 bytes in your document are the Byte Order Mark for UTF-8, wich is
optional.

--
Pascal Schmitt

Nov 12 '05 #5
> The 3 bytes in your document are the Byte Order Mark for UTF-8, wich is
optional.


"Byte Order Mark" makes sense for Unicode where the characters are read and
written as 16 bit quantities and where the byte order depends on the
endianity, not for UTF-8 where the data is read and written as a byte
stream.

For UTF-8, this is rather a "signature" .

Bruno
Nov 12 '05 #6

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

Similar topics

2
2440
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the XML file will get their row content from there. The rows may look some thing similar to this: - Added <a>mailing list</a> functionality to <a>homepage</a> - Competition winners announced, click <a>here</a>
3
1314
by: Diwa | last post by:
In TC++PL 3edn, in section 21.2.2, Stroustrup notes that put( ) and write( ) simply write chars. Therefore, << for outputting chars need not be a member What does he mean here ? Also, class basic_ostream does not have operator << (char ch)
0
444
by: Yobbo | last post by:
Hi All I have an ASP function in place to strip invalid chars out of a data store before I create an XML file of this data, but my function doesn't work on a certain set of chars. As far as I can see these are the following: a) trademark char b) long hyphen/dash char
3
5657
by: Yobbo | last post by:
Hi All I have an ASP function in place to strip invalid chars out of a data store before I create an XML file of this data, but my function doesn't work on a certain set of chars. As far as I can see these are the following: a) trademark char b) long hyphen/dash char
9
6591
by: Matthew | last post by:
I'm using PHP version 4.4.3. The manual page for PHP's mail() function (URL below) says that for the message (IE. email body) "Each line should be separated with a LF (\n). Lines should not be larger than 70 characters." http://uk2.php.net/manual/en/function.mail.php To see what happened I just sent an email using mail() with one of its lines exactly 100 chars. It was sent perfectly by sendmail as a line of
0
8063
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
8002
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
8496
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...
1
8148
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
6816
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, 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...
1
6013
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
5475
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();...
0
3962
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
1329
bsmnconsultancy
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...

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.