Re: Problem converting byte[] to string



Scott,

Why not just find out what encoding those other clients are using? The
server should be using some well-defined encoding scheme (ASCII, UTF8, or
something of that nature). When you find out what it is, just find the
corresponding .NET encoding class (in the System.Text namespace, most of
them are there), and run your bytes through that.

If it is not a well-defined encoding, then I would take the rules that
make up how the bytes are sent/transformed and derive a class from Encoding
that encapsulates these rules.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx


"scott" <scottamillard@xxxxxxxxxxx> wrote in message
news:d8mtfs$thf$1@xxxxxxxxxxxxxxxxxxxxxxx
> hi all, hope some one can help me, this prob is driving me mad.
>
>
>
> im using sockets to communicate between a client and a server. I don't'
> have control over the client and how it sends the data so i have had to
> try
> and work out how it is doing it. From what i can see it is sending the
> data
> in ASCII because if i try to use Unicode it just stops working, where's
> with
> ASCII i can get response from it and send and receive data.
>
>
>
> The problem.
>
>
>
> The client sends to me a load of data, most of it is ok however some of
> the
> data contains special text like §. When i try to decode one of these or
> anything else like it the decoding just goes wrong and it reads it as a _.
> I know that it must be possible because other people have been able to
> communicate with the client and use these special characters but i can't
> seem to.
>
>
>
> Does any one have any ideas ?
>
>
>
> Thx scott.
>
>


.



Relevant Pages

  • Re: POSTing Chinese characters
    ... your claims of POST'd data experiencing encoding problems does ... Character encoding of data on the client side ... Server locale ... it seems that your issue is a Pocket IE issue. ...
    (microsoft.public.inetserver.iis)
  • Re: NLS_LANG
    ... it can't be done from within the Oracle server. ... A client pretending to use the same character set as the database, ... Of course it is sometimes correct to have client encoding ...
    (comp.databases.oracle.tools)
  • Re: Problem converting byte[] to string
    ... I did acutlay try all the ones that exist in System.Text namespace and the ... only one that worked was the ASCII one. ... > Why not just find out what encoding those other clients are using? ... >> im using sockets to communicate between a client and a server. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Problem converting byte[] to string
    ... If it doesn't work for the ASCII one, then the encoding isn't ASCII. ... it is a special implementation based on the protocol. ... >>> im using sockets to communicate between a client and a server. ...
    (microsoft.public.dotnet.languages.csharp)
  • Frontier::Daemon encoding question
    ... The server is running on WinXP and the DB is on Win2000. ... the client and server executes correctly until the Frontier::Client is ... I've read that by setting the encoding of the XML to ISO-8859-1 someone ...
    (comp.lang.perl.modules)