I added three things here:
- The encoding before I change the encoding
- the encoding after the changes
- how I open the port and change the encoding
The "met accenten hé jà bèkes" and the "zonder accenten" are the SMS that I
tryed to send: they are dutch...
Before the SerialPort1.Encoding = System.Text.Encoding.GetEncoding(28591)
?serialport1.Encoding
{System.Text.ASCIIEncoding}
[System.Text.ASCIIEncoding]: {System.Text.ASCIIEncoding}
ASCII: {System.Text.ASCIIEncoding}
asciiEncoding: {System.Text.ASCIIEncoding}
BigEndianUnicode: {System.Text.UnicodeEncoding}
BodyName: "us-ascii"
ChineseHZ: 52936
CodePage: 20127
CodePageASCII: 20127
CodePageBigEndian: 1201
CodePageDefault: 0
CodePageDLLKorean: 20949
CodePageGB2312: 20936
CodePageMacGB2312: 10008
CodePageMacKorean: 10003
CodePageNoMac: 2
CodePageNoOEM: 1
CodePageNoSymbol: 42
CodePageNoThread: 3
CodePageUnicode: 1200
CodePageUTF32: 65005
CodePageUTF32BE: 65006
CodePageUTF7: 65000
CodePageUTF8: 65001
CodePageWindows1252: 1252
dataItem: {System.Globalization.CodePageDataItem}
DecoderFallback: {System.Text.DecoderReplacementFallback}
Default: {System.Text.SBCSCodePageEncoding}
defaultEncoding: {System.Text.SBCSCodePageEncoding}
DuplicateEUCCN: 51936
emptyByteArray: {Length=0}
ENC50229: 50229
EncoderFallback: {System.Text.EncoderReplacementFallback}
EncodingName: "US-ASCII"
encodings: {Length=1}
EUCCN: 936
EUCJP: 51932
EUCKR: 51949
GB18030: 54936
HeaderName: "us-ascii"
InternalSyncObject: {Object}
IsBrowserDisplay: False
IsBrowserSave: False
ISCIIAssemese: 57006
ISCIIBengali: 57003
ISCIIDevanagari: 57002
ISCIIGujarathi: 57010
ISCIIKannada: 57008
ISCIIMalayalam: 57009
ISCIIOriya: 57007
ISCIIPanjabi: 57011
ISCIITamil: 57004
ISCIITelugu: 57005
IsMailNewsDisplay: True
IsMailNewsSave: True
ISO_8859_1: 28591
ISO_8859_8_Visual: 28598
ISO_8859_8I: 38598
ISO2022JP: 50220
ISO2022JPESC: 50221
ISO2022JPSISO: 50222
ISOKorean: 50225
ISOSimplifiedCN: 50227
IsReadOnly: True
IsSingleByte: True
Latin1: {System.Text.Latin1Encoding}
latin1Encoding: {System.Text.Latin1Encoding}
m_codePage: 20127
m_deserializedFromEverett: False
m_isReadOnly: True
MIMECONTF_BROWSER: 2
MIMECONTF_MAIL1
MIMECONTF_SAVABLE_BROWSER: 512
MIMECONTF_SAVABLE_MAIL256
s_InternalSyncObject: {Object}
Unicode: {System.Text.UnicodeEncoding}
unicodeEncoding: {System.Text.UnicodeEncoding}
UTF32: {System.Text.UTF32Encoding}
utf32Encoding: {System.Text.UTF32Encoding}
UTF7: {System.Text.UTF7Encoding}
utf7Encoding: {System.Text.UTF7Encoding}
UTF8: {System.Text.UTF8Encoding}
utf8Encoding: {System.Text.UTF8Encoding}
WebName: "us-ascii"
WindowsCodePage: 1252
After the SerialPort1.Encoding = System.Text.Encoding.GetEncoding(28591)
?serialport1.Encoding
{System.Text.Latin1Encoding}
[System.Text.Latin1Encoding]: {System.Text.Latin1Encoding}
ASCII: {System.Text.ASCIIEncoding}
asciiEncoding: {System.Text.ASCIIEncoding}
BigEndianUnicode: {System.Text.UnicodeEncoding}
BodyName: "iso-8859-1"
ChineseHZ: 52936
CodePage: 28591
CodePageASCII: 20127
CodePageBigEndian: 1201
CodePageDefault: 0
CodePageDLLKorean: 20949
CodePageGB2312: 20936
CodePageMacGB2312: 10008
CodePageMacKorean: 10003
CodePageNoMac: 2
CodePageNoOEM: 1
CodePageNoSymbol: 42
CodePageNoThread: 3
CodePageUnicode: 1200
CodePageUTF32: 65005
CodePageUTF32BE: 65006
CodePageUTF7: 65000
CodePageUTF8: 65001
CodePageWindows1252: 1252
dataItem: {System.Globalization.CodePageDataItem}
DecoderFallback: {System.Text.InternalDecoderBestFitFallback}
Default: {System.Text.SBCSCodePageEncoding}
defaultEncoding: {System.Text.SBCSCodePageEncoding}
DuplicateEUCCN: 51936
emptyByteArray: {Length=0}
ENC50229: 50229
EncoderFallback: {System.Text.InternalEncoderBestFitFallback}
EncodingName: "Western European (ISO)"
encodings: {Length=2}
EUCCN: 936
EUCJP: 51932
EUCKR: 51949
GB18030: 54936
HeaderName: "iso-8859-1"
InternalSyncObject: {Object}
IsBrowserDisplay: True
IsBrowserSave: True
ISCIIAssemese: 57006
ISCIIBengali: 57003
ISCIIDevanagari: 57002
ISCIIGujarathi: 57010
ISCIIKannada: 57008
ISCIIMalayalam: 57009
ISCIIOriya: 57007
ISCIIPanjabi: 57011
ISCIITamil: 57004
ISCIITelugu: 57005
IsMailNewsDisplay: True
IsMailNewsSave: True
ISO_8859_1: 28591
ISO_8859_8_Visual: 28598
ISO_8859_8I: 38598
ISO2022JP: 50220
ISO2022JPESC: 50221
ISO2022JPSISO: 50222
ISOKorean: 50225
ISOSimplifiedCN: 50227
IsReadOnly: True
IsSingleByte: True
Latin1: {System.Text.Latin1Encoding}
latin1Encoding: {System.Text.Latin1Encoding}
m_codePage: 28591
m_deserializedFromEverett: False
m_isReadOnly: True
MIMECONTF_BROWSER: 2
MIMECONTF_MAIL1
MIMECONTF_SAVABLE_BROWSER: 512
MIMECONTF_SAVABLE_MAIL256
s_InternalSyncObject: {Object}
Unicode: {System.Text.UnicodeEncoding}
unicodeEncoding: {System.Text.UnicodeEncoding}
UTF32: {System.Text.UTF32Encoding}
utf32Encoding: {System.Text.UTF32Encoding}
UTF7: {System.Text.UTF7Encoding}
utf7Encoding: {System.Text.UTF7Encoding}
UTF8: {System.Text.UTF8Encoding}
utf8Encoding: {System.Text.UTF8Encoding}
WebName: "iso-8859-1"
WindowsCodePage: 1252
How I open it:
SerialPort1.PortName = strPortName '"COM1"
SerialPort1.BaudRate = intBaudRate '9600
SerialPort1.DataBits = intDataBits '8
SerialPort1.Parity = parParity 'Parity.None
SerialPort1.StopBits = stbStopBits 'StopBits.One
SerialPort1.Handshake = hskHandShake 'Handshake.None
SerialPort1.Open()
SerialPort1.Encoding = System.Text.Encoding.GetEncoding(28591)
DraguVaso said:
Thanks, I changed it and tryed to send some messages but I always got this
answer when I got accents in it:
"met accenten hé jà bèkes
OK
"
And not the "+CMGS: " that I normally should receive...
Even messages without accent don't work: there I get this as an answer for
mthe modem:
"zonder accenten
ERROR
"
Do you understand those messages? I don't know the language, I'm
afraid.
Messages without accents shouldn't be affected at all. Print out which
encoding the serial port class is using *before* you set it - that
could be useful information.