|
-
Aug 19th, 2003, 09:06 AM
#1
Thread Starter
Hyperactive Member
**SOLVED**Delete first Byte of a File // Read last Post
Hey all, i have a small problem and just cant find any solution to it.
I am creating a Xml Document and save this one with doc.save(path) This works all right, but I need the file to be saved UTF-8 encoded. I already have a encoding attribute in my Xml declaration, but c# doesn't seem to care about.
So heres my question, how can I save the document UTF-8 encoded?
Thanks in advance,
Stephan
Last edited by Sgt-Peppa; Aug 20th, 2003 at 09:13 AM.
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Aug 19th, 2003, 12:20 PM
#2
Code:
XmlDocument xmlDoc = new XmlDocument();
XmlNode encoding = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", String.Empty);
xmlDoc.AppendChild(encoding);
-
Aug 20th, 2003, 02:38 AM
#3
Thread Starter
Hyperactive Member
I am sorry, this is not working! I already have a xmldeclaration in my Document which already contains the encoding="UTF-8". But still, if I save myXmlDoc.save(path); it saves it as whatever, but not UTF-8.
Is it possible to Convert my XmlDom to a byte array, encode that one and then save it with a Streamwriter? And how?
Or is there any other way of getting my XmlDoc UTF-8 encoded?
Thanks,
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Aug 20th, 2003, 04:22 AM
#4
Thread Starter
Hyperactive Member
Hey, well i finally figuerd that one out, but have a new related problem:
Testing my Files I found out that my Xml Document definitely is UTF-8 Encoded. My Problem is that Microsoft usues a different UTF-8 Standard than java. The file creted from my C# function is supposed to be passed on to a java app. C# addes one byte at the beginnin of the document, java cant use.
NEW QUESTION: How can I open a file Binary and delete the first byte?
Thanks Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Aug 20th, 2003, 09:38 AM
#5
Thread Starter
Hyperactive Member
found a workaround thanks anyways
I just passed the xmldom as String to a StreamWriter which writes the doc without encoding!
Thanx anyways, Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|