ascii-socket problem with umlaut

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

ascii-socket problem with umlaut

Dziedzic, Peter

Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use sr = new StreamReader(stream);with sr.ReadLineand
sw = newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ascii-socket problem with umlaut

Georg Heeg

Peter,

 

Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:

 

Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.

 

I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.

 

What I would do?

1.      Find out which encoder what side uses

2.      Adapt both sides to use the same encoder explicitly

3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.

 

Georg

 

PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.

 

Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812

Tel. +49-3496-214328, Fax +49-3496-214712

Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet: Donnerstag, 25. Februar 2010 08:54
An: VWNC
Betreff: [vwnc] ascii-socket problem with umlaut

 


Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use sr = new StreamReader(stream);with sr.ReadLineand
sw = newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ascii-socket problem with umlaut

Janko Mivšek
In reply to this post by Dziedzic, Peter
Zdravo Peter,

I propose that you are sending in plain binary format, that is, open the
output stream in binary format then send text as bytes. That way you
could overcome any such problems the easiest way. Next step would be to
encode text in UTF-8 format ..

Lep pozdrav
Janko


On 25. 02. 2010 08:54, Dziedzic, Peter wrote:

> i have a problem with my ascii socket when i send german "Umlaute": e.g.
> Ü Ö Ä.
>
> I have a smalltalk application that communicates with a C#-appliacation
> over a Ascii-Socket.
>
> In Smalltalk i use *stream nextPutAll: aString; *and *stream nextLine.*
> In C# I use* **sr = new** **StreamReader**(stream);*with *sr.ReadLine*and
> sw = newStreamWriter(stream); with *sw.WriteLine.*
>
> How can i fix this problem? Is the problem the smalltalk or the C#-side?
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ascii-socket problem with umlaut

Bruce Badger
In reply to this post by Dziedzic, Peter
If this really is an "ASCII" socket then I would guess it won't pass
non-ASCII characters.  If you wish to pass any unicode character, use
a regular octet (byte) socket interface and pass UTF-8 encoded data,

On 25 February 2010 07:54, Dziedzic, Peter <[hidden email]> wrote:

>
> Hello,
>
> i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö
> Ä.
>
> I have a smalltalk application that communicates with a C#-appliacation over
> a Ascii-Socket.
>
> In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
> In C# I use sr = new StreamReader(stream);with sr.ReadLineand
> sw = newStreamWriter(stream); with sw.WriteLine.
>
> How can i fix this problem? Is the problem the smalltalk or the C#-side?
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain
> business or company secrets. If you have received this email in error,
> please contact the sender and delete the message immediately. Any use of
> this email, including saving, publishing, copying, replication or forwarding
> of the message or the contents is not permitted.
>
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>



--
Make the most of your skills - with OpenSkills
http://www.openskills.org/

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ascii-socket problem with umlaut

Steven Kelly
In reply to this post by Dziedzic, Peter

You need to make sure that you use the same encoding for both ends of the socket stream. C# StreamReader uses UTF-8 by default, and VW uses the platform’s default, in your case probably Windows-1252 (roughly the Microsoft version of ISO-8859-1). Make VW use UTF-8 when you create the socket or stream – e.g.

 

readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF

 

HTH,

Steve

From: [hidden email] [mailto:[hidden email]] On Behalf Of Dziedzic, Peter
Sent: 25 February 2010 09:54
To: VWNC
Subject: [vwnc] ascii-socket problem with umlaut

 


Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use sr = new StreamReader(stream);with sr.ReadLineand
sw = newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Antwort: AW: ascii-socket problem with umlaut

Dziedzic, Peter
In reply to this post by Georg Heeg

Hello,

the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).

Do i have to convert the string with the following code in my smalltalk enviroment to utf8?

 stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString

Is this correct for the smalltalk side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12

An
"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>
Kopie
Thema
AW: [vwnc] ascii-socket problem with umlaut





Peter,
 
Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:
 
Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.
 
I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.
 
What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.
 
Georg
 
PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.
 
Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut

 

Hello,


i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.


I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.


In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw =
newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: AW: ascii-socket problem with umlaut

Georg Heeg

Peter,

 

no your statement stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString is plain wrong. You should follow the hint provided Stve Kelly and use readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF

 

Georg

 

Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812

Tel. +49-3496-214328, Fax +49-3496-214712

Von: Dziedzic, Peter [mailto:[hidden email]]
Gesendet: Donnerstag, 25. Februar 2010 10:40
An: Georg Heeg
Cc: [hidden email]
Betreff: Antwort: AW: [vwnc] ascii-socket problem with umlaut

 


Hello,

the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).

Do i have to convert the string with the following code in my smalltalk enviroment to utf8?

 stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString

Is this correct for the smalltalk side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12

An

"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>

Kopie

Thema

AW: [vwnc] ascii-socket problem with umlaut

 




Peter,
 
Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:
 
Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.
 
I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.
 
What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.
 
Georg
 
PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.
 
Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712
Von: [hidden email] [hidden email] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut

 

Hello,


i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.


I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.


In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw = newStreamWriter(stream); with
sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
[hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: AW: ascii-socket problem with umlaut

Steven Kelly
In reply to this post by Dziedzic, Peter

That might work, but it’s not right :-). #asByteString will try to read the UTF-8 bytes as if they were ISO-8859-1 bytes; in this case that may succeed, but in general you shouldn’t try to read with a different encoding than you used when writing: it will often give errors, because not all sequences of bytes are legal in all encodings.

 

You need to change the encoding of the socket stream, which will mean that when you send a Ü character, it is automatically converted into the right sequence of UTF-8 bytes. You can supply the encoding to the socket when you create it. If the code I sent before:

readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF

doesn’t look similar enough to how you’re currently opening your socket stream, tell us the code you are using and we’ll tell you where to add the encoding command.

 

Steve

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Dziedzic, Peter
Sent: 25 February 2010 11:40
To: Georg Heeg
Cc: [hidden email]
Subject: [vwnc] Antwort: AW: ascii-socket problem with umlaut

 


Hello,

the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).

Do i have to convert the string with the following code in my smalltalk enviroment to utf8?

 stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString

Is this correct for the smalltalk side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12

An

"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>

Kopie

Thema

AW: [vwnc] ascii-socket problem with umlaut

 




Peter,
 
Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:
 
Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.
 
I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.
 
What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.
 
Georg
 
PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.
 
Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut

 

Hello,


i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.


I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.


In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw = newStreamWriter(stream); with
sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
[hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Antwort: RE: Antwort: AW: ascii-socket problem with umlaut

Dziedzic, Peter

Hello,

I open my socket with the following code:

| host port connection |
...        

        host := 'localhost'.

        "Try to get port from services-file of the pc.
        if not then use default-value"
        Signal errorSignal handle:
                [:ex |
                Transcript
                        show: ex description;
                        cr.
                port := 49700]
                do: [
                        port := IPSocketAddress servicePortByName: 'TestSocket'].

        Signal errorSignal handle:
                        [:ex |
                        Transcript
                                show: 'socket connection failed';
                                cr.
                        ^false]
                do:
                        ["Create a socket on the given host and port."

                        socket := SocketAccessor newTCPclientToHost: host
                                                port: (port)].        "Open a two-way connection on the socket."
        connection := ExternalConnection new.
        connection
                input: socket;
                output: socket.        "Open a stream on the socket connection."
        stream := connection readAppendStream.
        ...

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





"Steven Kelly" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 10:58

An
"Dziedzic, Peter" <[hidden email]>
Kopie
<[hidden email]>
Thema
RE: [vwnc] Antwort: AW:  ascii-socket problem with umlaut





That might work, but it’s not right :-). #asByteString will try to read the UTF-8 bytes as if they were ISO-8859-1 bytes; in this case that may succeed, but in general you shouldn’t try to read with a different encoding than you used when writing: it will often give errors, because not all sequences of bytes are legal in all encodings.
 
You need to change the encoding of the socket stream, which will mean that when you send a Ü character, it is automatically converted into the right sequence of UTF-8 bytes. You can supply the encoding to the socket when you create it. If the code I sent before:
readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF
doesn’t look similar enough to how you’re currently opening your socket stream, tell us the code you are using and we’ll tell you where to add the encoding command.
 
Steve
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of Dziedzic, Peter
Sent:
25 February 2010 11:40
To:
Georg Heeg
Cc:
[hidden email]
Subject:
[vwnc] Antwort: AW: ascii-socket problem with umlaut

 

Hello,


the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).


Do i have to convert the string with the following code in my smalltalk enviroment to utf8?


stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString


Is this correct for the smalltalk side?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346



"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12


An
"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>
Kopie
Thema
AW: [vwnc] ascii-socket problem with umlaut

 







Peter,

Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:

Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.

I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.

What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.

Georg

PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.

Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712

Von:
[hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut



Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw =
newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: RE: Antwort: AW: ascii-socket problem with umlaut

Steven Kelly

Change the lines:

      connection := ExternalConnection new.
        connection
                input: socket;
                output: socket.        

to:

      connection := (ExternalConnection ioAccessor: socket) withEncoding: #'UTF-8'

 

You can also send your stream “lineEndCRLF”, since I imagine that is what C# is going to be using.

 

HTH,

Steve

 

From: Dziedzic, Peter [mailto:[hidden email]]
Sent: 25 February 2010 12:01
To: Steven Kelly
Cc: [hidden email]
Subject: Antwort: RE: [vwnc] Antwort: AW: ascii-socket problem with umlaut

 


Hello,

I open my socket with the following code:

| host port connection |
...        

        host := 'localhost'.

        "Try to get port from services-file of the pc.
        if not then use default-value"
        Signal errorSignal handle:
                [:ex |
                Transcript
                        show: ex description;
                        cr.
                port := 49700]
                do: [
                        port := IPSocketAddress servicePortByName: 'TestSocket'].

        Signal errorSignal handle:
                        [:ex |
                        Transcript
                                show: 'socket connection failed';
                                cr.
                        ^false]
                do:
                        ["Create a socket on the given host and port."

                        socket := SocketAccessor newTCPclientToHost: host
                                                port: (port)].        "Open a two-way connection on the socket."
        connection := ExternalConnection new.
        connection
                input: socket;
                output: socket.        "Open a stream on the socket connection."
        stream := connection readAppendStream.
        ...

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




"Steven Kelly" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 10:58

An

"Dziedzic, Peter" <[hidden email]>

Kopie

<[hidden email]>

Thema

RE: [vwnc] Antwort: AW:  ascii-socket problem with umlaut

 




That might work, but it’s not right :-). #asByteString will try to read the UTF-8 bytes as if they were ISO-8859-1 bytes; in this case that may succeed, but in general you shouldn’t try to read with a different encoding than you used when writing: it will often give errors, because not all sequences of bytes are legal in all encodings.
 
You need to change the encoding of the socket stream, which will mean that when you send a Ü character, it is automatically converted into the right sequence of UTF-8 bytes. You can supply the encoding to the socket when you create it. If the code I sent before:
readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF
doesn’t look similar enough to how you’re currently opening your socket stream, tell us the code you are using and we’ll tell you where to add the encoding command.
 
Steve
 
From: [hidden email] [mailto:[hidden email]] On Behalf Of Dziedzic, Peter
Sent:
25 February 2010 11:40
To:
Georg Heeg
Cc:
[hidden email]
Subject:
[vwnc] Antwort: AW: ascii-socket problem with umlaut

 

Hello,


the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).


Do i have to convert the string with the following code in my smalltalk enviroment to utf8?


stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString


Is this correct for the smalltalk side?


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346


"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12

 

An

"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>

Kopie

Thema

AW: [vwnc] ascii-socket problem with umlaut


 

 





Peter,

Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:

Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.

I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.

What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.

Georg

PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.

Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712

Von:
[hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut



Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw = newStreamWriter(stream); with
sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
[hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Antwort: RE: Antwort: RE: Antwort: AW: ascii-socket problem with umlaut

Dziedzic, Peter

Hello,

thank you for your code-change-advice.
it works very well.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





"Steven Kelly" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 11:14

An
"Dziedzic, Peter" <[hidden email]>
Kopie
<[hidden email]>
Thema
RE: Antwort: RE: [vwnc] Antwort: AW:  ascii-socket problem with umlaut





Change the lines:
      connection := ExternalConnection new.
       connection
               input: socket;
               output: socket.        

to:
      connection := (ExternalConnection ioAccessor: socket) withEncoding: #'UTF-8'
 
You can also send your stream “lineEndCRLF”, since I imagine that is what C# is going to be using.
 
HTH,
Steve
 
From: Dziedzic, Peter [mailto:[hidden email]]
Sent:
25 February 2010 12:01
To:
Steven Kelly
Cc:
[hidden email]
Subject:
Antwort: RE: [vwnc] Antwort: AW: ascii-socket problem with umlaut

 

Hello,


I open my socket with the following code:


| host port connection |
...        


       host := 'localhost'.


       "Try to get port from services-file of the pc.
       if not then use default-value"
       Signal errorSignal handle:
               [:ex |
               Transcript
                       show: ex description;
                       cr.
               port := 49700]
               do: [
                       port := IPSocketAddress servicePortByName: 'TestSocket'].


       Signal errorSignal handle:
                       [:ex |
                       Transcript
                               show: 'socket connection failed';
                               cr.
                       ^false]
               do:
                       ["Create a socket on the given host and port."


                       socket := SocketAccessor newTCPclientToHost: host
                                               port: (port)].        "Open a two-way connection on the socket."
       connection := ExternalConnection new.
       connection
               input: socket;
               output: socket.        "Open a stream on the socket connection."
       stream := connection readAppendStream.
       ...


Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346



"Steven Kelly" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 10:58


An
"Dziedzic, Peter" <[hidden email]>
Kopie
<[hidden email]>
Thema
RE: [vwnc] Antwort: AW:  ascii-socket problem with umlaut

 







That might work, but it’s not right :-). #asByteString will try to read the UTF-8 bytes as if they were ISO-8859-1 bytes; in this case that may succeed, but in general you shouldn’t try to read with a different encoding than you used when writing: it will often give errors, because not all sequences of bytes are legal in all encodings.

You need to change the encoding of the socket stream, which will mean that when you send a Ü character, it is automatically converted into the right sequence of UTF-8 bytes. You can supply the encoding to the socket when you create it. If the code I sent before:
readStream := (aSocket asExternalConnection withEncoding: #'UTF-8') readStream lineEndCRLF
doesn’t look similar enough to how you’re currently opening your socket stream, tell us the code you are using and we’ll tell you where to add the encoding command.

Steve

From:
[hidden email] [mailto:[hidden email]] On Behalf Of Dziedzic, Peter
Sent:
25 February 2010 11:40
To:
Georg Heeg
Cc:
[hidden email]
Subject:
[vwnc] Antwort: AW: ascii-socket problem with umlaut



Hello,

the default-encoder in my smalltalk-application is #ISO8859_1 (  'Ü'  stringEncoding streamEncodingType ).

Do i have to convert the string with the following code in my smalltalk enviroment to utf8?

stringToSend := (stringToSend asByteArrayEncoding:#utf8) asByteString

Is this correct for the smalltalk side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346

"Georg Heeg" <[hidden email]>
Gesendet von: [hidden email]

25.02.2010 09:12

 


An
"'Dziedzic, Peter'" <[hidden email]>, "'VWNC'" <[hidden email]>
Kopie
Thema
AW: [vwnc] ascii-socket problem with umlaut


 







Peter,

Last Sunday I commented in this list in an email entitled “Postgres 'ERROR: invalid byte sequence for encoding             "UTF8": 0xe97269” about the same problem. Thus here you’ll find only a short version:

Sockets provide a communication as a sequence of bytes. Thus characters (in Smalltalk Strings are sequences of Character objects) are encoded as bytes using en encoder. In your code the default encoder is implicitly used. I can only guess that this encoder might be UTF-8 or MSCP1252 or ISO8859-L1. You can find out easily by debugging the Smalltalk expression.

I have no idea about the C# side. I guess C# is using MSCP1252 or UTF16.

What I would do?
1.      Find out which encoder what side uses
2.      Adapt both sides to use the same encoder explicitly
3.      As your application is used world-wide, I would rather prefer UFT-8 (if most of your customers are using Latin character sets) or UTF16 otherwise.

Georg

PS: The character set ASCII you mention in the subject line cannot encode umlauts at all.


Georg Heeg eK, Dortmund und Köthen, HR Dortmund A 12812
Tel. +49-3496-214328, Fax +49-3496-214712

Von:
[hidden email] [mailto:[hidden email]] Im Auftrag von Dziedzic, Peter
Gesendet:
Donnerstag, 25. Februar 2010 08:54
An:
VWNC
Betreff:
[vwnc] ascii-socket problem with umlaut



Hello,

i have a problem with my ascii socket when i send german "Umlaute": e.g. Ü Ö Ä.

I have a smalltalk application that communicates with a C#-appliacation over a Ascii-Socket.

In Smalltalk i use stream nextPutAll: aString; and stream nextLine.
In C# I use
sr = new StreamReader(stream);withsr.ReadLineand
sw =
newStreamWriter(stream); with sw.WriteLine.

How can i fix this problem? Is the problem the smalltalk or the C#-side?

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc