473,714 Members | 3,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

encoding.ascii

I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan
Jun 30 '08 #1
9 4139
Before we start, let's get rid of the trees so that we can see the wood:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim plainTextBytes As Byte() = Encoding.ASCII. GetBytes(plainT ext)

Dim decodeString As String = Encoding.ASCII. GetString(plain TextBytes)

MessageBox.Show ("after " & decodeString)

The 1st MessageBox.Show displays before te and the 2nd displays after
t???e which is exactly correct and is also what is expected.

The reason that the 'apparent' space does not show between the and the e
in the 1st MessageBox.Show is that, in a proportional font, that particular
ANSI character, (144 decimal), has either no width or is very narrow. I may
be corrected on this but I think it is called an emSpace, which I interpret
as meaning that it is 1 em wide, which is 1 point which is also 1/72 of an
inch.

The two preceeding characters have the codes 226 decimal and 8226 decimal
respectively. The first of these is in the ASNI range but the second
requires 2 bytes to represent and therefore is true unicode.

The documentation for the Encoding.ASCII. GetBytes method states
categorically that it 'encodes all the characters in the specified string
into a sequence of bytes'. Nowhere does it give the impression that it
'strips' characters out. When it comes across a non-ASCII character or an
ASCII charcater that is considered 'unprintable' it substutes the byte &3FH
(63 decimal) which, of course, is the ? character. Therefore, the after
t???e displayed by the 2nd MessageBox.Show is correct.

If you really want the non-ASCII and ASCII 'unprintable' characters stripped
out then you can use any number of algorithms that REMOVE the 'offending'
characters from the string. One such algorithm is demonstrated:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
Now, the 1st MessageBox.Show displays before te and the 2nd displays after
te which is what you appear to want.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:4F******** *************** ***********@mic rosoft.com...
>I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan
Jun 30 '08 #2
Stephany,
thanks for the code.
When I ran your code the returned value included the ? character. I changed
your code to:
Dim decodeString As String
Dim i As Integer
decodeString = String.Empty
For i = 0 To plainText.Lengt h - 1
If plainTextBytes( i) >= 32 And _
plainTextBytes( i) <= 126 And plainTextBytes( i) <63 Then
decodeString += plainText(i)
End If
Next

and only the "te" appeared.

I assume that Encoding.ascii. getbytes converts all valid ASCII characters to
their hex value and Encoding.ascii. getstring returns the printable character
of valid ASCII characters. If any value is not valid the hex value of 63 is
used.

Again thanks for your help. It was very informative.
Dan
"Stephany Young" wrote:
Before we start, let's get rid of the trees so that we can see the wood:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim plainTextBytes As Byte() = Encoding.ASCII. GetBytes(plainT ext)

Dim decodeString As String = Encoding.ASCII. GetString(plain TextBytes)

MessageBox.Show ("after " & decodeString)

The 1st MessageBox.Show displays before tâ•e and the 2nd displays after
t???e which is exactly correct and is also what is expected.

The reason that the 'apparent' space does not show between the • and the e
in the 1st MessageBox.Show is that, in a proportional font, that particular
ANSI character, (144 decimal), has either no width or is very narrow. I may
be corrected on this but I think it is called an emSpace, which I interpret
as meaning that it is 1 em wide, which is 1 point which is also 1/72 of an
inch.

The two preceeding characters have the codes 226 decimal and 8226 decimal
respectively. The first of these is in the ASNI range but the second
requires 2 bytes to represent and therefore is true unicode.

The documentation for the Encoding.ASCII. GetBytes method states
categorically that it 'encodes all the characters in the specified string
into a sequence of bytes'. Nowhere does it give the impression that it
'strips' characters out. When it comes across a non-ASCII character or an
ASCII charcater that is considered 'unprintable' it substutes the byte &3FH
(63 decimal) which, of course, is the ? character. Therefore, the after
t???e displayed by the 2nd MessageBox.Show is correct.

If you really want the non-ASCII and ASCII 'unprintable' characters stripped
out then you can use any number of algorithms that REMOVE the 'offending'
characters from the string. One such algorithm is demonstrated:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
Now, the 1st MessageBox.Show displays before tâ•e and the 2nd displays after
te which is what you appear to want.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:4F******** *************** ***********@mic rosoft.com...
I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan

Jun 30 '08 #3
It's important that you understand what happens and it is not clear that you
actually do. Your use of inappropriate terminogly is what causes this
suspicion.

There is no conversion to any 'hex' value. A 'hex' value is nothing more
than a readable representation of something. More importantly, 63 is the
DECIMAL representation of the ? character. 3F is the 'hex' representation.

You don't have to assume anything. The documentation for the
Encoding.ASCII. GetBytes method, that I referred you to, tells you EXACTLY
what it does. Note the use, in the documentation, of the phrase 'all
characters'.

In general, if the decimal representation for a character in the specified
string is in the range 32 to 126 inclusive, then the actual character is
used otherwise the ? character is used as a substitute. If there are any
exceptions to the general rule, I have yet to encounter any.

When you used the code fragment I posted, and you still got a ? in your
result then the 'before' string must have contained a ? character, which of
course is perfectly valid. It is, of course a punctuation mark that
indicates a question and therefore can appear in all sorts of strings.

It is apparent that you do not have Option Strict set. If this is the case
then I stringly recommend that you set it ON and leave it that way.

When you turn it on you will find that your code will not compile without
warnings and may not even compile at all.

The main thing is that you should not be excluding ? from the new string.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:16******** *************** ***********@mic rosoft.com...
Stephany,
thanks for the code.
When I ran your code the returned value included the ? character. I
changed
your code to:
Dim decodeString As String
Dim i As Integer
decodeString = String.Empty
For i = 0 To plainText.Lengt h - 1
If plainTextBytes( i) >= 32 And _
plainTextBytes( i) <= 126 And plainTextBytes( i) <63 Then
decodeString += plainText(i)
End If
Next

and only the "te" appeared.

I assume that Encoding.ascii. getbytes converts all valid ASCII characters
to
their hex value and Encoding.ascii. getstring returns the printable
character
of valid ASCII characters. If any value is not valid the hex value of 63
is
used.

Again thanks for your help. It was very informative.
Dan
"Stephany Young" wrote:
>Before we start, let's get rid of the trees so that we can see the wood:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim plainTextBytes As Byte() = Encoding.ASCII. GetBytes(plainT ext)

Dim decodeString As String = Encoding.ASCII. GetString(plain TextBytes)

MessageBox.Show ("after " & decodeString)

The 1st MessageBox.Show displays before tâ•e and the 2nd displays
after
t???e which is exactly correct and is also what is expected.

The reason that the 'apparent' space does not show between the • and
the e
in the 1st MessageBox.Show is that, in a proportional font, that
particular
ANSI character, (144 decimal), has either no width or is very narrow. I
may
be corrected on this but I think it is called an emSpace, which I
interpret
as meaning that it is 1 em wide, which is 1 point which is also 1/72 of
an
inch.

The two preceeding characters have the codes 226 decimal and 8226 decimal
respectively . The first of these is in the ASNI range but the second
requires 2 bytes to represent and therefore is true unicode.

The documentation for the Encoding.ASCII. GetBytes method states
categoricall y that it 'encodes all the characters in the specified string
into a sequence of bytes'. Nowhere does it give the impression that it
'strips' characters out. When it comes across a non-ASCII character or
an
ASCII charcater that is considered 'unprintable' it substutes the byte
&3FH
(63 decimal) which, of course, is the ? character. Therefore, the after
t???e displayed by the 2nd MessageBox.Show is correct.

If you really want the non-ASCII and ASCII 'unprintable' characters
stripped
out then you can use any number of algorithms that REMOVE the 'offending'
characters from the string. One such algorithm is demonstrated:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
Now, the 1st MessageBox.Show displays before tâ•e and the 2nd displays
after
te which is what you appear to want.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:4F******* *************** ************@mi crosoft.com...
>I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately
the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan

Jul 1 '08 #4
Stephany Young wrote:
I may be corrected on this but I think it is called
an emSpace, which I interpret as meaning that it is 1 em wide, which
is 1 point which is also 1/72 of an inch.
I'm have no knowledge of whether or not 144 represents an em space in some
code page, but, for the sake of completeness, that isn't the size of an em:
http://en.wikipedia.org/wiki/Em_%28typography%29

Andrew
Jul 1 '08 #5
Stephany,
The reason that the 'apparent' space does not show between the and the e
in the 1st MessageBox.Show is that, in a proportional font, that
particular ANSI character, (144 decimal), has either no width or is very
narrow. I may be corrected on this but I think it is called an emSpace,
which I interpret as meaning that it is 1 em wide, which is 1 point which
is also 1/72 of an inch.
There are no ANSI characters. So please don't make the confusion wider.
ASCII is a 7 bit character code system, while EBCDIC is an 8 bit.

Most variants not on real mainframes derive from ASCII. However if in those
the most significant bit is used the byte can represent in every code page
another bit range for a character.

Cor

Jul 1 '08 #6
Stephany,
Thanks for the information.
As to your point that the original string had a "?" character included, that
is not true. Maybe the confusion is that I don't understand the function
AscW(plainText( _i). In all the testing that I have done, all encoding
functions change a decimal value than 127 to a decimal 63. I can remove
all the "?" from the string but I will also remove the intended "?".
Dan
"Stephany Young" wrote:
Before we start, let's get rid of the trees so that we can see the wood:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim plainTextBytes As Byte() = Encoding.ASCII. GetBytes(plainT ext)

Dim decodeString As String = Encoding.ASCII. GetString(plain TextBytes)

MessageBox.Show ("after " & decodeString)

The 1st MessageBox.Show displays before tâ•e and the 2nd displays after
t???e which is exactly correct and is also what is expected.

The reason that the 'apparent' space does not show between the • and the e
in the 1st MessageBox.Show is that, in a proportional font, that particular
ANSI character, (144 decimal), has either no width or is very narrow. I may
be corrected on this but I think it is called an emSpace, which I interpret
as meaning that it is 1 em wide, which is 1 point which is also 1/72 of an
inch.

The two preceeding characters have the codes 226 decimal and 8226 decimal
respectively. The first of these is in the ASNI range but the second
requires 2 bytes to represent and therefore is true unicode.

The documentation for the Encoding.ASCII. GetBytes method states
categorically that it 'encodes all the characters in the specified string
into a sequence of bytes'. Nowhere does it give the impression that it
'strips' characters out. When it comes across a non-ASCII character or an
ASCII charcater that is considered 'unprintable' it substutes the byte &3FH
(63 decimal) which, of course, is the ? character. Therefore, the after
t???e displayed by the 2nd MessageBox.Show is correct.

If you really want the non-ASCII and ASCII 'unprintable' characters stripped
out then you can use any number of algorithms that REMOVE the 'offending'
characters from the string. One such algorithm is demonstrated:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
Now, the 1st MessageBox.Show displays before tâ•e and the 2nd displays after
te which is what you appear to want.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:4F******** *************** ***********@mic rosoft.com...
I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan

Jul 2 '08 #7
The Ascw(Char) method returns an Integer value representing the character
code corresponding to a Unicode character. This can be 0 through 65535. The
returned value is independent of the culture and code page settings for the
current thread.

Using a subscript to access the individual characters makes use of the fact
that you can treat a String as if it were an array of Char.

So, the code fragment:

decodeString = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

does nothing more than append all characters from plainText that have their
character codes in the range 32 to 126 inclusive, to decodeString which is,
initially, empty.

Therefore, if you end up with a ? (character code 63) in decodeString, then
it was present in plainText. QED.

If you use another methodology in an attempt to 'remove' non-ASCII and/or
ASCII non-printable characters form a string then you may end up with a
different result, because the culture and/or code page settings for the
current thread may be taken into account.

There is another factor that could come into play here and that is one or
more of the characters in plainText has a character code of 0 (NUL). If you
display such a string with MessageBox.Show , among other methods, then those
characters after the NUL will NOT be displayed.

For example, the string "ABCDE" & ChrW(0) & "?" would be displayed as
"ABCDE" but after running the above fragment, the result would be "ABCDE?",
the removal of the NUL character having 'exposed' the "?" that you didn't
realise was actually present.

One way of detecting the presence of a NUL character is:

If plainText.Conta ins(ChrW(0)) Then
' NUL character is present
Else
' NUL character is NOT present
End If

Note that the ChrW(Integer) method is, effectively, the reverse of the
AscW(Char) method in that it returns the character associated with the
specified character code. The character code can be in the range -32768
through 65535 but the values -32768 through -1 are treated the same as
values in the range 32768 through 65535.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:7B******** *************** ***********@mic rosoft.com...
Stephany,
Thanks for the information.
As to your point that the original string had a "?" character included,
that
is not true. Maybe the confusion is that I don't understand the function
AscW(plainText( _i). In all the testing that I have done, all encoding
functions change a decimal value than 127 to a decimal 63. I can remove
all the "?" from the string but I will also remove the intended "?".
Dan
"Stephany Young" wrote:
>Before we start, let's get rid of the trees so that we can see the wood:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim plainTextBytes As Byte() = Encoding.ASCII. GetBytes(plainT ext)

Dim decodeString As String = Encoding.ASCII. GetString(plain TextBytes)

MessageBox.Show ("after " & decodeString)

The 1st MessageBox.Show displays before tâ•e and the 2nd displays
after
t???e which is exactly correct and is also what is expected.

The reason that the 'apparent' space does not show between the • and
the e
in the 1st MessageBox.Show is that, in a proportional font, that
particular
ANSI character, (144 decimal), has either no width or is very narrow. I
may
be corrected on this but I think it is called an emSpace, which I
interpret
as meaning that it is 1 em wide, which is 1 point which is also 1/72 of
an
inch.

The two preceeding characters have the codes 226 decimal and 8226 decimal
respectively . The first of these is in the ASNI range but the second
requires 2 bytes to represent and therefore is true unicode.

The documentation for the Encoding.ASCII. GetBytes method states
categoricall y that it 'encodes all the characters in the specified string
into a sequence of bytes'. Nowhere does it give the impression that it
'strips' characters out. When it comes across a non-ASCII character or
an
ASCII charcater that is considered 'unprintable' it substutes the byte
&3FH
(63 decimal) which, of course, is the ? character. Therefore, the after
t???e displayed by the 2nd MessageBox.Show is correct.

If you really want the non-ASCII and ASCII 'unprintable' characters
stripped
out then you can use any number of algorithms that REMOVE the 'offending'
characters from the string. One such algorithm is demonstrated:

Dim plainText As String = "t═e"

MessageBox.Show ("before " & plainText)

Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
Now, the 1st MessageBox.Show displays before tâ•e and the 2nd displays
after
te which is what you appear to want.
"Dan" <Da*@discussion s.microsoft.com wrote in message
news:4F******* *************** ************@mi crosoft.com...
>I have the following code section that I thought would strip out all the
non-ascii characters from a string after decoding it. Unfortunately
the
non-ascii characters are still in the string.
What am I doing wrong?

Dim plainText As String
plainText = "t═e"
Dim plainTextBytes( ) As Byte
Dim enc As Encoding = Encoding.ASCII
plainTextBytes = enc.GetBytes(pl ainText)
Dim str As String
str = enc.GetString(p lainTextBytes). ToString
MessageBox.Show ("before " & str)

Dim decodeString As String = enc.GetString(p lainTextBytes)
MessageBox.Show ("after " & decodeString)
Any help would be greatly appreciated.
Dan

Jul 2 '08 #8
"Stephany Young" <noone@localhos tschrieb:
Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)
If the OP thinks about adopting this solution for longer strings, I suggest
to take a look at the 'StringBuilder' class for faster string
concatenations.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jul 3 '08 #9
The actual methodology used in any given situation will, of course, need to
take into account things like performance requirements and the size of
objects along with any number of other considerations. That goes without
saying Herfried.

All 'we' are doing here is demonstrating one (among a myriad) of
methodologies that can be used to achieve the correct result. Obviously
achieving the correct result is the most important consideration.

The main thrust of the whole thing is that any given methodology can have
pitfalls, depending on the circumstances, given the nuances of
string-handling when various cultures and/or code pages come into the mix.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.atwrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
"Stephany Young" <noone@localhos tschrieb:
> Dim decodeString As String = String.Empty

For _i = 0 To plainText.Lengt h - 1
If AscW(plainText( _i)) >= 32 AndAlso AscW(plainText( _i)) < 127 Then
decodeString &= plainText(_i)
Next

MessageBox.Show ("after " & decodeString)

If the OP thinks about adopting this solution for longer strings, I
suggest to take a look at the 'StringBuilder' class for faster string
concatenations.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 3 '08 #10

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

Similar topics

14
2529
by: Dylan | last post by:
Here's what I'm trying to do: - scrape some html content from various sources The issue I'm running to: - some of the sources have incorrectly encoded characters... for example, cp1252 curly quotes that were likely the result of the author copying and pasting content from Word
48
4628
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at once) * regular expression search & replace. Normally my documents are encoded with the ISO setting. Recently I was writing an XHTML document. After changing the encoding to UTF-8 I used the
10
687
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6 codepage system wide. As much as it sounds good, UTF/Unicode encoding is not an option, nor is changing the codepage. Tackling the first is easy via Encoding.Default.GetBytes and shoving it over the network. However, Encoding.Default is the...
37
10155
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be accidentally entered are properly represented when the document is served. My programming language allows me to get the ascii value for any individual character so what I am doing when a change is saved is to look at each character in the content and...
10
30178
by: Mark Rae | last post by:
Hi, I'm in the process if converting the data out of an old DOS-based SunAccounts system (don't ask!) into SQL Server. The data has been sent to me as a collection of hundreds of SunAccounts backup files and it's a simple (yet extremely laborious!) process of opening each backup file in turn, reading the file line by line, splitting it up into its constituent parts, and then squirting it into SQL Server.
0
1971
by: Chris McDonough | last post by:
ElementTree's XML serialization routine implied by tree._write(file, node, encoding, namespaces looks like this (elided): def _write(self, file, node, encoding, namespaces): # write XML to file tag = node.tag if tag is Comment: file.write("<!-- %s -->" % _escape_cdata(node.text, encoding)) elif tag is ProcessingInstruction: file.write("<?%s?>" % _escape_cdata(node.text, encoding))
5
6210
by: Mike Currie | last post by:
Can anyone explain why I'm getting an ascii encoding error when I'm trying to write out using a UTF-8 encoder? Thanks Python 2.4.3 (#69, Mar 29 2006, 17:35:34) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> filterMap = {} >>> for i in range(0,255):
19
3330
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 "fdselsdag". I stored the string as "fdselsdag" but somewhere in my code it got translated into the mess above and I cannot get the original string back. It cannot be printed in the console or written a plain text-file. I've tried to convert it using
8
5061
by: aine_canby | last post by:
The following line in my code is failing because sys.stdin.encoding is Null. This has only started happening since I started working with Pydef in Eclipse SDK. Any ideas? uni=unicode(word,sys.stdin.encoding) Thanks, Aine.
0
8814
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8713
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9187
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7957
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5961
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4730
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3160
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.