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

ASCII to PDU convertion and back

Hi,

For my SMS-application I need to be able to send characters with accents
(like é and à). But this doesn't seem to work in Text Mode, so i will need
to do it in PDU Mode.

Does anybody has soem converting routines for that in VB.NET? I need my text
to be converted to a PDU-message, and back (for received messages).

Thansk in advance,

Pieter

Nov 21 '05 #1
13 5273
DraguVaso <pi**********@hotmail.com> wrote:
For my SMS-application I need to be able to send characters with accents
(like é and à). But this doesn't seem to work in Text Mode, so i willneed
to do it in PDU Mode.
How did you try to do it in text mode? You'll need to know the encoding
to use, of course. Note that characters with accents in *aren't* part
of ASCII.
Does anybody has soem converting routines for that in VB.NET? I need my text
to be converted to a PDU-message, and back (for received messages).


http://www.dreamfabric.com/sms/ seems to have quite a bit of
information in it...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #2
I tryed to set them just in ir, but that didn't work.
for exemple:
AT+GMGS="0486112233"
This is my message with accents éà<Ctrl-Z>

Do you know the way to send the accents in text-mode? I assume it must
exist, but I can't find how :-(

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DraguVaso <pi**********@hotmail.com> wrote:
For my SMS-application I need to be able to send characters with accents
(like é and à). But this doesn't seem to work in Text Mode, so i will need
to do it in PDU Mode.
How did you try to do it in text mode? You'll need to know the encoding
to use, of course. Note that characters with accents in *aren't* part
of ASCII.
Does anybody has soem converting routines for that in VB.NET? I need my text to be converted to a PDU-message, and back (for received messages).


http://www.dreamfabric.com/sms/ seems to have quite a bit of
information in it...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #3
Pieter,

I do not know this stuff however afaik is Frites written as you see here,
not Fàités.

I was curious so I have looked at some pages and I found unicode 8859-1

http://www.dreamfabric.com/sms/

What is the standard in our language zone as far as I know.

http://de.wikipedia.org/wiki/Windows-1252#Windows-1252

(And I am curious where do you use that à and what kind of keyboards do you
use Querty or Azerty?)

Cor

"DraguVaso" <pi**********@hotmail.com> schreef in bericht
news:uX*************@TK2MSFTNGP15.phx.gbl...
Hi,

For my SMS-application I need to be able to send characters with accents
(like é and à). But this doesn't seem to work in Text Mode, so i will need
to do it in PDU Mode.

Does anybody has soem converting routines for that in VB.NET? I need my
text
to be converted to a PDU-message, and back (for received messages).

Thansk in advance,

Pieter

Nov 21 '05 #4
DraguVaso <pi**********@hotmail.com> wrote:
I tryed to set them just in ir, but that didn't work.
for exemple:
AT+GMGS="0486112233"
This is my message with accents éà<Ctrl-Z>

Do you know the way to send the accents in text-mode? I assume it must
exist, but I can't find how :-(


Well, what API are you using to submit the text to start with?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #5
I'm not using an API: I'm using VB.NET 2005 with the SerialPort-object, if
that is what you mean...

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DraguVaso <pi**********@hotmail.com> wrote:
I tryed to set them just in ir, but that didn't work.
for exemple:
AT+GMGS="0486112233"
This is my message with accents éà<Ctrl-Z>

Do you know the way to send the accents in text-mode? I assume it must
exist, but I can't find how :-(


Well, what API are you using to submit the text to start with?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #6
DraguVaso <pi**********@hotmail.com> wrote:
I'm not using an API: I'm using VB.NET 2005 with the SerialPort-object, if
that is what you mean...


Well, that *is* using an API. Anyway...

Anyway, how are you then writing the data to the port? Are you writing
a byte array, or a string? Either way, what encoding are you using?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #7
I'm really having troubles to udnerstand what you exactly need to know...

I'm writing a string all the time.
Some of my routines:

Public Sub PinInsert(ByVal strPin As String)
ModemStatus = enumModemStatus.PinValidation
WriteToComPort("AT+CPIN=" & strPin & cstCR)
MessageSilent("Inserting the Pin...")
End Sub

Public Sub SetToTextMode()
ModemStatus = enumModemStatus.TextModeValidation
WriteToComPort("AT+CMGF=1" & cstCR)
MessageSilent("Setting to TextMode...")
End Sub

Public Sub WriteToComPort(ByVal strMessage As String)
SerialPort1.Write(strMessage)
End Sub

Public Sub SmsSendNumber(ByVal strNumber As String)
ModemStatus = enumModemStatus.SmsNumberSending
WriteToComPort("AT+CMGS=" & Chr(34) & strNumber & Chr(34) & cstCR)
End Sub

Public Sub SmsSendMessage(ByVal strMessage As String)
ModemStatus = enumModemStatus.SmsMessageSending
WriteToComPort(strMessage & Chr(26))
End Sub
It works really fine with just normal text, but once I begin using accents
the accents don't come through....
strMessage is like this: "hello world" or "érica"

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DraguVaso <pi**********@hotmail.com> wrote:
I'm not using an API: I'm using VB.NET 2005 with the SerialPort-object, if that is what you mean...


Well, that *is* using an API. Anyway...

Anyway, how are you then writing the data to the port? Are you writing
a byte array, or a string? Either way, what encoding are you using?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 21 '05 #8
DraguVaso <pi**********@hotmail.com> wrote:
I'm really having troubles to udnerstand what you exactly need to know...
<snip>
Public Sub WriteToComPort(ByVal strMessage As String)
SerialPort1.Write(strMessage)
End Sub


Okay, that's the bit I needed to know - you're using whatever encoding
the SerialPort class is providing by default.

Try changing that to ISO-8859-1:

SerialPort1.Encoding = Encoding.GetEncoding (28591);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #9
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
"
.... :-/

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DraguVaso <pi**********@hotmail.com> wrote:
I'm really having troubles to udnerstand what you exactly need to
know...
<snip>
Public Sub WriteToComPort(ByVal strMessage As String)
SerialPort1.Write(strMessage)
End Sub


Okay, that's the bit I needed to know - you're using whatever encoding
the SerialPort class is providing by default.

Try changing that to ISO-8859-1:

SerialPort1.Encoding = Encoding.GetEncoding (28591);

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 21 '05 #10
DraguVaso <pi**********@hotmail.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #11
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_MAILNEWS: 1
MIMECONTF_SAVABLE_BROWSER: 512
MIMECONTF_SAVABLE_MAILNEWS: 256
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_MAILNEWS: 1
MIMECONTF_SAVABLE_BROWSER: 512
MIMECONTF_SAVABLE_MAILNEWS: 256
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)

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
DraguVaso <pi**********@hotmail.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #12
DraguVaso <pi**********@hotmail.com> wrote:
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...


<snip>

Ah, I see. Well, sending "zonder accenten" should be identical whether
you're using ASCII or ISO-8859-1.

On the other hand, I see you're using an unprintable character at the
end of the text. I'd strongly recommend sending any binary values as
bytes rather than still using the encoding for that.

Given that you're setting it to "text" mode though, I wonder whether
you might not be limited to ASCII anyway - you may need to change
something else to use non-ASCII characters.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 21 '05 #13
Given that you're setting it to "text" mode though, I wonder whether
you might not be limited to ASCII anyway - you may need to change
something else to use non-ASCII characters.


err... so trying to change to PDU would be the thing to do... :-/
Althoug I'm looking almost a whole day on that stuff, and I still wasn't
able to send a message with pdu :-(
Nov 21 '05 #14

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

Similar topics

17
by: DraguVaso | last post by:
Hi, For my SMS-application I need to be able to send characters with accents (like é and à). But this doesn't seem to work in Text Mode, so i will need to do it in PDU Mode. Does anybody has...
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...
8
by: sdlt85 | last post by:
Hi, the program is asking the user for a number ant he base of the number, then it will convert the number to decimal. But is running right only with base 2, 3, 4, 5, 6, 7, 8 but if I try 16 it is...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.