473,388 Members | 1,480 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,388 software developers and data experts.

Unicode - ASCII ?

N
Hi,
I'm writing a small web service (using C#) which is going to receive a text
file, add a line to it and send it back.
Input is a string with each line ending with "\r\n".
The problem is in the format of the output - looks like all ends of lines
are missing, even if web service just receives and sends back the same
string.

Could it be some encoding issue?

Thanks in advance!

Nov 23 '05 #1
1 1810
Hi,

The likely issue is that in XML, an end of line is considered white-space.
Each end of an XML processing pair has the option of making their
processors ignore white-space, and I suspect that your choice of trying to
treat multiple records like there were one element is at the root of the
problem.

Have you thought about either using Soap with attachments to transfer the
file in/out, or using a data structure more suitable to passing multiple
records > (e.g. something like this from an on-the-wire perspective?)

<myFile>
<record number="1">the quick brown fox jumped over the lazy dog</record>
<record number="2">every good boy deserves fudge</record>
</myFile>

you could easliy create a class from the following schema fragment that you
would then pass as the input and output type, and you 'd get away from all
of those platform/caller specfic white-space processing rules...

<xs:complexType name="myFile">
<xs:complexContent>
<xs:sequence>
<xs:element name="record" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:complexContent>
</xs:complexType>

Throw that in a schema, run it thru XsdObjectGen.exe and you'll have
classes that implement the collection of records. It may not be the file
you had in mind, but a simple file/reader to collection to web call back to
file wrapper is pretty straight forward. Optionally, just make the
resulting XMl the desired file format in the first place, and you can load
the data to be passed as a myFile class type directly in 2 lines.

I hope this helps

Dan Rogers
Microsoft Corporation

--------------------
Thread-Topic: Unicode - ASCII ?
thread-index: AcTs/JSY4Pj/8/U2SfGKkqY/YUfuqQ==
X-WBNR-Posting-Host: 208.4.218.82
From: "=?Utf-8?B?Tg==?=" <N@discussions.microsoft.com>
Subject: Unicode - ASCII ?
Date: Tue, 28 Dec 2004 08:45:04 -0800
Lines: 12
Message-ID: <8C**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:8326
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,
I'm writing a small web service (using C#) which is going to receive a text
file, add a line to it and send it back.
Input is a string with each line ending with "\r\n".
The problem is in the format of the output - looks like all ends of lines
are missing, even if web service just receives and sends back the same
string.

Could it be some encoding issue?

Thanks in advance!
Nov 23 '05 #2

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

Similar topics

8
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5,...
14
by: wolfgang haefelinger | last post by:
Hi, I wonder whether someone could explain me a bit what's going on here: import sys # I'm running Mandrake 1o and Windows XP. print sys.version ## 2.3.3 (#2, Feb 17 2004, 11:45:40)
4
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
1
by: olsongt | last post by:
I was going to submit to sourceforge, but my unicode skills are weak. I was trying to strip characters from a string that contained values outside of ASCII. I though I could just encode as 'ascii'...
24
by: ChaosKCW | last post by:
Hi I am reading from an oracle database using cx_Oracle. I am writing to a SQLite database using apsw. The oracle database is returning utf-8 characters for euopean item names, ie special...
4
by: Petr Jakes | last post by:
Hi, I am using Python 2.4.3 on Fedora Core4 and "Eric3" Python IDE .. Below mentioned code works fine in the Eric3 environment. While trying to start it from the command line, it returns: ...
19
by: Thomas W | last post by:
I'm getting really annoyed with python in regards to unicode/ascii-encoding problems. The string below is the encoding of the norwegian word "fødselsdag". I stored the string as "fødselsdag"...
9
by: Jim | last post by:
Hello, I'm trying to write exception-handling code that is OK in the presence of unicode error messages. I seem to have gotten all mixed up and I'd appreciate any un-mixing that anyone can...
7
by: 7stud | last post by:
Based on this example and the error: ----- u_str = u"abc\u9999" print u_str UnicodeEncodeError: 'ascii' codec can't encode character u'\u9999' in position 3: ordinal not in range(128) ------
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.