473,473 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Replacing char

Hello,

I need to replace this char  with another char.
However I am not able to acieve this. I tried this but it
doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?
Nov 18 '05 #1
12 2569
The "replace" needs either two characters or two strings. In your case, try:

Dim c As Char = Chr(194)
str = str.Replace(c.ToString, "")

Or why not just str.replace("Â", "")?

Bill

"anonymous" wrote:
Hello,

I need to replace this char  with another char.
However I am not able to acieve this. I tried this but it
doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?

Nov 18 '05 #2
I tried both versions, but it still doesnt work. The thing
is that I am reading the following rss
(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating
the file with the description of the item. The file
contains only the description with the strange chars. Here
is my complete code:

Dim reader As New XmlTextReader
("http://pluralsight.com/blogs/dbox/Rss.aspx")
Dim xmlDoc As New XmlDocument

xmlDoc.Load(reader)

Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")
dim i as integer = 0

For Each node As XmlNode In nodes
Try
strPost = node("description").InnerXml
Dim c as char = Chr(194)
strPost = strPost.Replace("Â", "XX")
Dim fp As StreamWriter
dim strfile as string = Server.MapPath("xml_news//")
strfile = strfile & i.tostring()
strfile = strfile & ".asp"
fp = File.CreateText(strfile)
fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
& "</p>")
fp.close()
Catch ex As Exception
Response.Write(ex.Message() & "<br>")
End Try
i = i + 1
Next

Thanks for any help.
-----Original Message-----
The "replace" needs either two characters or two strings. In your case, try:
Dim c As Char = Chr(194)
str = str.Replace(c.ToString, "")

Or why not just str.replace("Ã,", "")?

Bill

"anonymous" wrote:
Hello,

I need to replace this char Ã, with another char.
However I am not able to acieve this. I tried this but it doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?

.

Nov 18 '05 #3
I don't see any Âs in the feed? Is it really the character you want to
replace?
cheers,
mortb

"anonymous" <an*******@discussions.microsoft.com> wrote in message
news:46****************************@phx.gbl...
I tried both versions, but it still doesnt work. The thing
is that I am reading the following rss
(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating
the file with the description of the item. The file
contains only the description with the strange chars. Here
is my complete code:

Dim reader As New XmlTextReader
("http://pluralsight.com/blogs/dbox/Rss.aspx")
Dim xmlDoc As New XmlDocument

xmlDoc.Load(reader)

Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")
dim i as integer = 0

For Each node As XmlNode In nodes
Try
strPost = node("description").InnerXml
Dim c as char = Chr(194)
strPost = strPost.Replace("Â", "XX")
Dim fp As StreamWriter
dim strfile as string = Server.MapPath("xml_news//")
strfile = strfile & i.tostring()
strfile = strfile & ".asp"
fp = File.CreateText(strfile)
fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
& "</p>")
fp.close()
Catch ex As Exception
Response.Write(ex.Message() & "<br>")
End Try
i = i + 1
Next

Thanks for any help.
-----Original Message-----
The "replace" needs either two characters or two strings. In your case, try:
Dim c As Char = Chr(194)
str = str.Replace(c.ToString, "")

Or why not just str.replace("Ã,", "")?

Bill

"anonymous" wrote:
Hello,

I need to replace this char Ã, with another char.
However I am not able to acieve this. I tried this but it doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?

.

Nov 18 '05 #4
Try my code and you will see that the asp page contains
this character.

-----Original Message-----
I don't see any Âs in the feed? Is it really the character you want to replace?
cheers,
mortb

"anonymous" <an*******@discussions.microsoft.com> wrote in message news:46****************************@phx.gbl...
I tried both versions, but it still doesnt work. The thing
is that I am reading the following rss
(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating
the file with the description of the item. The file
contains only the description with the strange chars. Here
is my complete code:

Dim reader As New XmlTextReader
("http://pluralsight.com/blogs/dbox/Rss.aspx")
Dim xmlDoc As New XmlDocument

xmlDoc.Load(reader)

Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")
dim i as integer = 0

For Each node As XmlNode In nodes
Try
strPost = node("description").InnerXml
Dim c as char = Chr(194)
strPost = strPost.Replace("Â", "XX")
Dim fp As StreamWriter
dim strfile as string = Server.MapPath("xml_news//")
strfile = strfile & i.tostring()
strfile = strfile & ".asp"
fp = File.CreateText(strfile)
fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
& "</p>")
fp.close()
Catch ex As Exception
Response.Write(ex.Message() & "<br>")
End Try
i = i + 1
Next

Thanks for any help.
-----Original Message-----
The "replace" needs either two characters or two strings.

In your case, try:

Dim c As Char = Chr(194)
str = str.Replace(c.ToString, "")

Or why not just str.replace("Ã,", "")?

Bill

"anonymous" wrote:
Hello,

I need to replace this char Ã, with another char.
However I am not able to acieve this. I tried this butit doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?

.

.

Nov 18 '05 #5
I get exceptions when I run your code ("could not find a part of the path"),
but tracing through still don't see the  (e.g. strPost.IndexOf("Â") fails).
Is it possible you have a code page problem?

Bill

"anonymous" wrote:
Try my code and you will see that the asp page contains
this character.

-----Original Message-----
I don't see any Âs in the feed? Is it really the

character you want to
replace?
cheers,
mortb

"anonymous" <an*******@discussions.microsoft.com> wrote

in message
news:46****************************@phx.gbl...
I tried both versions, but it still doesnt work. The thing
is that I am reading the following rss
(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating
the file with the description of the item. The file
contains only the description with the strange chars. Here
is my complete code:

Dim reader As New XmlTextReader
("http://pluralsight.com/blogs/dbox/Rss.aspx")
Dim xmlDoc As New XmlDocument

xmlDoc.Load(reader)

Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")
dim i as integer = 0

For Each node As XmlNode In nodes
Try
strPost = node("description").InnerXml
Dim c as char = Chr(194)
strPost = strPost.Replace("Â", "XX")
Dim fp As StreamWriter
dim strfile as string = Server.MapPath("xml_news//")
strfile = strfile & i.tostring()
strfile = strfile & ".asp"
fp = File.CreateText(strfile)
fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
& "</p>")
fp.close()
Catch ex As Exception
Response.Write(ex.Message() & "<br>")
End Try
i = i + 1
Next

Thanks for any help.
-----Original Message-----
The "replace" needs either two characters or two strings.

In your case, try:

Dim c As Char = Chr(194)
str = str.Replace(c.ToString, "")

Or why not just str.replace("Ã,", "")?

Bill

"anonymous" wrote:

Hello,

I need to replace this char Ã, with another char.
However I am not able to acieve this. I tried this but

it
doesnt work:

str = str.Replace(chr(asc(194)), "")

Can somebody help ?

.

.

Nov 18 '05 #6
The A character only appear in the created file. Ofcourse
you need the change the path so that it works on your
system.

Please help.
-----Original Message-----
I get exceptions when I run your code ("could not find a part of the path"), but tracing through still don't see the Ã, (e.g. strPost.IndexOf("Ã,") fails). Is it possible you have a code page problem?

Bill

"anonymous" wrote:
Try my code and you will see that the asp page contains
this character.



>-----Original Message-----
>I don't see any Ã,s in the feed? Is it really the

character you want to
>replace?
>cheers,
>mortb
>
>"anonymous" <an*******@discussions.microsoft.com> wrote
in message
>news:46****************************@phx.gbl...
>I tried both versions, but it still doesnt work. The

thing >is that I am reading the following rss
>(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating >the file with the description of the item. The file
>contains only the description with the strange chars. Here >is my complete code:
>
>Dim reader As New XmlTextReader
>("http://pluralsight.com/blogs/dbox/Rss.aspx")
>Dim xmlDoc As New XmlDocument
>
>xmlDoc.Load(reader)
>
>Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>("/rss/channel/item")
>dim i as integer = 0
>
>For Each node As XmlNode In nodes
>Try
> strPost = node("description").InnerXml
> Dim c as char = Chr(194)
> strPost = strPost.Replace("Ã,", "XX")
> Dim fp As StreamWriter
> dim strfile as string = Server.MapPath ("xml_news//") > strfile = strfile & i.tostring()
> strfile = strfile & ".asp"
> fp = File.CreateText(strfile)
> fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>& "</p>")
> fp.close()
>Catch ex As Exception
> Response.Write(ex.Message() & "<br>")
>End Try
>i = i + 1
>Next
>
>Thanks for any help.
>
>>-----Original Message-----
>>The "replace" needs either two characters or two strings. >In your case, try:
>>
>> Dim c As Char = Chr(194)
>> str = str.Replace(c.ToString, "")
>>
>>Or why not just str.replace("Ãf,", "")?
>>
>>Bill
>>
>>"anonymous" wrote:
>>
>>> Hello,
>>>
>>> I need to replace this char Ãf, with another char. >>> However I am not able to acieve this. I tried this but >it
>>> doesnt work:
>>>
>>> str = str.Replace(chr(asc(194)), "")
>>>
>>> Can somebody help ?
>>>
>>.
>>
>
>
>.
>


.

Nov 18 '05 #7
My dumb mistake on the path. Looks like the source has some nonbreaking
spaces ( ascii 160), which the htmldecode is turning into asc 194. I'm
guessing you could do your replace *after* the decode, else replace on 160
*before* the decode. As to why that space is not encoded, whereas, say, the
<'s are correctly converted to < etc., I don't know. Not sure if that happens
on the rss end, or maybe in your textreader. Anyway, I'm not familiar with
grabbing a feed the way you're doing it, so can't offer much more. Hopefully
this will get you going.

Bill

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse
you need the change the path so that it works on your
system.

Please help.
-----Original Message-----
I get exceptions when I run your code ("could not find a

part of the path"),
but tracing through still don't see the Ã, (e.g.

strPost.IndexOf("Ã,") fails).
Is it possible you have a code page problem?

Bill

"anonymous" wrote:
Try my code and you will see that the asp page contains
this character.


>-----Original Message-----
>I don't see any Ã,s in the feed? Is it really the
character you want to
>replace?
>cheers,
>mortb
>
>"anonymous" <an*******@discussions.microsoft.com> wrote in message
>news:46****************************@phx.gbl...
>I tried both versions, but it still doesnt work. The thing >is that I am reading the following rss
>(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating >the file with the description of the item. The file
>contains only the description with the strange chars. Here >is my complete code:
>
>Dim reader As New XmlTextReader
>("http://pluralsight.com/blogs/dbox/Rss.aspx")
>Dim xmlDoc As New XmlDocument
>
>xmlDoc.Load(reader)
>
>Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>("/rss/channel/item")
>dim i as integer = 0
>
>For Each node As XmlNode In nodes
>Try
> strPost = node("description").InnerXml
> Dim c as char = Chr(194)
> strPost = strPost.Replace("Ã,", "XX")
> Dim fp As StreamWriter
> dim strfile as string = Server.MapPath ("xml_news//") > strfile = strfile & i.tostring()
> strfile = strfile & ".asp"
> fp = File.CreateText(strfile)
> fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>& "</p>")
> fp.close()
>Catch ex As Exception
> Response.Write(ex.Message() & "<br>")
>End Try
>i = i + 1
>Next
>
>Thanks for any help.
>
>>-----Original Message-----
>>The "replace" needs either two characters or two strings. >In your case, try:
>>
>> Dim c As Char = Chr(194)
>> str = str.Replace(c.ToString, "")
>>
>>Or why not just str.replace("Ãf,", "")?
>>
>>Bill
>>
>>"anonymous" wrote:
>>
>>> Hello,
>>>
>>> I need to replace this char Ãf, with another char. >>> However I am not able to acieve this. I tried this but >it
>>> doesnt work:
>>>
>>> str = str.Replace(chr(asc(194)), "")
>>>
>>> Can somebody help ?
>>>
>>.
>>
>
>
>.
>

.

Nov 18 '05 #8
Thanks man. That did the trick. I was replacing 194 before
encoding. Now I am replacing 160 before encoding and it
works like a charm. How did you know that it 160 before
encoding?

Thanks

-----Original Message-----
My dumb mistake on the path. Looks like the source has some nonbreaking spaces ( ascii 160), which the htmldecode is turning into asc 194. I'm guessing you could do your replace *after* the decode, else replace on 160 *before* the decode. As to why that space is not encoded, whereas, say, the <'s are correctly converted to < etc., I don't know. Not sure if that happens on the rss end, or maybe in your textreader. Anyway, I'm not familiar with grabbing a feed the way you're doing it, so can't offer much more. Hopefully this will get you going.

Bill

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse you need the change the path so that it works on your
system.

Please help.


>-----Original Message-----
>I get exceptions when I run your code ("could not find a
part of the path"),
>but tracing through still don't see the Ãf, (e.g.

strPost.IndexOf("Ãf,") fails).
>Is it possible you have a code page problem?
>
>Bill
>
>"anonymous" wrote:
>
>> Try my code and you will see that the asp page
contains >> this character.
>>
>>
>>
>>
>> >-----Original Message-----
>> >I don't see any Ãf,s in the feed? Is it really the
>> character you want to
>> >replace?
>> >cheers,
>> >mortb
>> >
>> >"anonymous" <an*******@discussions.microsoft.com>

wrote
>> in message
>> >news:46****************************@phx.gbl...
>> >I tried both versions, but it still doesnt work.

The thing
>> >is that I am reading the following rss
>> >(http://pluralsight.com/blogs/dbox/Rss.aspx) and

creating
>> >the file with the description of the item. The file
>> >contains only the description with the strange
chars. Here
>> >is my complete code:
>> >
>> >Dim reader As New XmlTextReader
>> >("http://pluralsight.com/blogs/dbox/Rss.aspx")
>> >Dim xmlDoc As New XmlDocument
>> >
>> >xmlDoc.Load(reader)
>> >
>> >Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>> >("/rss/channel/item")
>> >dim i as integer = 0
>> >
>> >For Each node As XmlNode In nodes
>> >Try
>> > strPost = node("description").InnerXml
>> > Dim c as char = Chr(194)
>> > strPost = strPost.Replace("Ãf,", "XX")
>> > Dim fp As StreamWriter
>> > dim strfile as string = Server.MapPath

("xml_news//")
>> > strfile = strfile & i.tostring()
>> > strfile = strfile & ".asp"
>> > fp = File.CreateText(strfile)
>> > fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>> >& "</p>")
>> > fp.close()
>> >Catch ex As Exception
>> > Response.Write(ex.Message() & "<br>")
>> >End Try
>> >i = i + 1
>> >Next
>> >
>> >Thanks for any help.
>> >
>> >>-----Original Message-----
>> >>The "replace" needs either two characters or two

strings.
>> >In your case, try:
>> >>
>> >> Dim c As Char = Chr(194)
>> >> str = str.Replace(c.ToString, "")
>> >>
>> >>Or why not just str.replace("Ãff,", "")?
>> >>
>> >>Bill
>> >>
>> >>"anonymous" wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I need to replace this char Ãff, with
another char.
>> >>> However I am not able to acieve this. I tried
this but
>> >it
>> >>> doesnt work:
>> >>>
>> >>> str = str.Replace(chr(asc(194)), "")
>> >>>
>> >>> Can somebody help ?
>> >>>
>> >>.
>> >>
>> >
>> >
>> >.
>> >
>>
>.
>


.

Nov 18 '05 #9
P.S. There's a good article here you might find interesting:

http://aspnet.4guysfromrolla.com/articles/031903-1.aspx

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse
you need the change the path so that it works on your
system.

Please help.
-----Original Message-----
I get exceptions when I run your code ("could not find a

part of the path"),
but tracing through still don't see the Ã, (e.g.

strPost.IndexOf("Ã,") fails).
Is it possible you have a code page problem?

Bill

"anonymous" wrote:
Try my code and you will see that the asp page contains
this character.


>-----Original Message-----
>I don't see any Ã,s in the feed? Is it really the
character you want to
>replace?
>cheers,
>mortb
>
>"anonymous" <an*******@discussions.microsoft.com> wrote in message
>news:46****************************@phx.gbl...
>I tried both versions, but it still doesnt work. The thing >is that I am reading the following rss
>(http://pluralsight.com/blogs/dbox/Rss.aspx) and creating >the file with the description of the item. The file
>contains only the description with the strange chars. Here >is my complete code:
>
>Dim reader As New XmlTextReader
>("http://pluralsight.com/blogs/dbox/Rss.aspx")
>Dim xmlDoc As New XmlDocument
>
>xmlDoc.Load(reader)
>
>Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>("/rss/channel/item")
>dim i as integer = 0
>
>For Each node As XmlNode In nodes
>Try
> strPost = node("description").InnerXml
> Dim c as char = Chr(194)
> strPost = strPost.Replace("Ã,", "XX")
> Dim fp As StreamWriter
> dim strfile as string = Server.MapPath ("xml_news//") > strfile = strfile & i.tostring()
> strfile = strfile & ".asp"
> fp = File.CreateText(strfile)
> fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>& "</p>")
> fp.close()
>Catch ex As Exception
> Response.Write(ex.Message() & "<br>")
>End Try
>i = i + 1
>Next
>
>Thanks for any help.
>
>>-----Original Message-----
>>The "replace" needs either two characters or two strings. >In your case, try:
>>
>> Dim c As Char = Chr(194)
>> str = str.Replace(c.ToString, "")
>>
>>Or why not just str.replace("Ãf,", "")?
>>
>>Bill
>>
>>"anonymous" wrote:
>>
>>> Hello,
>>>
>>> I need to replace this char Ãf, with another char. >>> However I am not able to acieve this. I tried this but >it
>>> doesnt work:
>>>
>>> str = str.Replace(chr(asc(194)), "")
>>>
>>> Can somebody help ?
>>>
>>.
>>
>
>
>.
>

.

Nov 18 '05 #10
Its a regular article about consuming rss. I do it the
same way. Thanks :)

-----Original Message-----
P.S. There's a good article here you might find interesting:
http://aspnet.4guysfromrolla.com/articles/031903-1.aspx

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse you need the change the path so that it works on your
system.

Please help.


>-----Original Message-----
>I get exceptions when I run your code ("could not find a
part of the path"),
>but tracing through still don't see the Ãf, (e.g.

strPost.IndexOf("Ãf,") fails).
>Is it possible you have a code page problem?
>
>Bill
>
>"anonymous" wrote:
>
>> Try my code and you will see that the asp page
contains >> this character.
>>
>>
>>
>>
>> >-----Original Message-----
>> >I don't see any Ãf,s in the feed? Is it really the
>> character you want to
>> >replace?
>> >cheers,
>> >mortb
>> >
>> >"anonymous" <an*******@discussions.microsoft.com>

wrote
>> in message
>> >news:46****************************@phx.gbl...
>> >I tried both versions, but it still doesnt work.

The thing
>> >is that I am reading the following rss
>> >(http://pluralsight.com/blogs/dbox/Rss.aspx) and

creating
>> >the file with the description of the item. The file
>> >contains only the description with the strange
chars. Here
>> >is my complete code:
>> >
>> >Dim reader As New XmlTextReader
>> >("http://pluralsight.com/blogs/dbox/Rss.aspx")
>> >Dim xmlDoc As New XmlDocument
>> >
>> >xmlDoc.Load(reader)
>> >
>> >Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>> >("/rss/channel/item")
>> >dim i as integer = 0
>> >
>> >For Each node As XmlNode In nodes
>> >Try
>> > strPost = node("description").InnerXml
>> > Dim c as char = Chr(194)
>> > strPost = strPost.Replace("Ãf,", "XX")
>> > Dim fp As StreamWriter
>> > dim strfile as string = Server.MapPath

("xml_news//")
>> > strfile = strfile & i.tostring()
>> > strfile = strfile & ".asp"
>> > fp = File.CreateText(strfile)
>> > fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>> >& "</p>")
>> > fp.close()
>> >Catch ex As Exception
>> > Response.Write(ex.Message() & "<br>")
>> >End Try
>> >i = i + 1
>> >Next
>> >
>> >Thanks for any help.
>> >
>> >>-----Original Message-----
>> >>The "replace" needs either two characters or two

strings.
>> >In your case, try:
>> >>
>> >> Dim c As Char = Chr(194)
>> >> str = str.Replace(c.ToString, "")
>> >>
>> >>Or why not just str.replace("Ãff,", "")?
>> >>
>> >>Bill
>> >>
>> >>"anonymous" wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I need to replace this char Ãff, with
another char.
>> >>> However I am not able to acieve this. I tried
this but
>> >it
>> >>> doesnt work:
>> >>>
>> >>> str = str.Replace(chr(asc(194)), "")
>> >>>
>> >>> Can somebody help ?
>> >>>
>> >>.
>> >>
>> >
>> >
>> >.
>> >
>>
>.
>


.

Nov 18 '05 #11
I just looked at the 194's, then went back to those same positions in the
original and found the 160's by dumping the ascii values of those strings. I
had also guessed it might be something with &nbsp's, which is always a decent
bet when something looks ok on the screen but your code chokes on it. Have
fun.

"Anonymous" wrote:
Thanks man. That did the trick. I was replacing 194 before
encoding. Now I am replacing 160 before encoding and it
works like a charm. How did you know that it 160 before
encoding?

Thanks

-----Original Message-----
My dumb mistake on the path. Looks like the source has

some nonbreaking
spaces ( ascii 160), which the htmldecode is turning

into asc 194. I'm
guessing you could do your replace *after* the decode,

else replace on 160
*before* the decode. As to why that space is not encoded,

whereas, say, the
<'s are correctly converted to < etc., I don't know. Not

sure if that happens
on the rss end, or maybe in your textreader. Anyway, I'm

not familiar with
grabbing a feed the way you're doing it, so can't offer

much more. Hopefully
this will get you going.

Bill

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse you need the change the path so that it works on your
system.

Please help.

>-----Original Message-----
>I get exceptions when I run your code ("could not find a part of the path"),
>but tracing through still don't see the Ãf, (e.g.
strPost.IndexOf("Ãf,") fails).
>Is it possible you have a code page problem?
>
>Bill
>
>"anonymous" wrote:
>
>> Try my code and you will see that the asp page contains >> this character.
>>
>>
>>
>>
>> >-----Original Message-----
>> >I don't see any Ãf,s in the feed? Is it really the
>> character you want to
>> >replace?
>> >cheers,
>> >mortb
>> >
>> >"anonymous" <an*******@discussions.microsoft.com>
wrote
>> in message
>> >news:46****************************@phx.gbl...
>> >I tried both versions, but it still doesnt work. The thing
>> >is that I am reading the following rss
>> >(http://pluralsight.com/blogs/dbox/Rss.aspx) and
creating
>> >the file with the description of the item. The file
>> >contains only the description with the strange chars. Here
>> >is my complete code:
>> >
>> >Dim reader As New XmlTextReader
>> >("http://pluralsight.com/blogs/dbox/Rss.aspx")
>> >Dim xmlDoc As New XmlDocument
>> >
>> >xmlDoc.Load(reader)
>> >
>> >Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>> >("/rss/channel/item")
>> >dim i as integer = 0
>> >
>> >For Each node As XmlNode In nodes
>> >Try
>> > strPost = node("description").InnerXml
>> > Dim c as char = Chr(194)
>> > strPost = strPost.Replace("Ãf,", "XX")
>> > Dim fp As StreamWriter
>> > dim strfile as string = Server.MapPath
("xml_news//")
>> > strfile = strfile & i.tostring()
>> > strfile = strfile & ".asp"
>> > fp = File.CreateText(strfile)
>> > fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>> >& "</p>")
>> > fp.close()
>> >Catch ex As Exception
>> > Response.Write(ex.Message() & "<br>")
>> >End Try
>> >i = i + 1
>> >Next
>> >
>> >Thanks for any help.
>> >
>> >>-----Original Message-----
>> >>The "replace" needs either two characters or two
strings.
>> >In your case, try:
>> >>
>> >> Dim c As Char = Chr(194)
>> >> str = str.Replace(c.ToString, "")
>> >>
>> >>Or why not just str.replace("Ãff,", "")?
>> >>
>> >>Bill
>> >>
>> >>"anonymous" wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I need to replace this char Ãff, with another char.
>> >>> However I am not able to acieve this. I tried this but
>> >it
>> >>> doesnt work:
>> >>>
>> >>> str = str.Replace(chr(asc(194)), "")
>> >>>
>> >>> Can somebody help ?
>> >>>
>> >>.
>> >>
>> >
>> >
>> >.
>> >
>>
>.
>

.

Nov 18 '05 #12
Hey, wasn't regular to me--I learned all sorts of new things from your post,
thanks.

"Anonymous" wrote:
Its a regular article about consuming rss. I do it the
same way. Thanks :)

-----Original Message-----
P.S. There's a good article here you might find

interesting:

http://aspnet.4guysfromrolla.com/articles/031903-1.aspx

"Anonymous" wrote:
The A character only appear in the created file. Ofcourse you need the change the path so that it works on your
system.

Please help.

>-----Original Message-----
>I get exceptions when I run your code ("could not find a part of the path"),
>but tracing through still don't see the Ãf, (e.g.
strPost.IndexOf("Ãf,") fails).
>Is it possible you have a code page problem?
>
>Bill
>
>"anonymous" wrote:
>
>> Try my code and you will see that the asp page contains >> this character.
>>
>>
>>
>>
>> >-----Original Message-----
>> >I don't see any Ãf,s in the feed? Is it really the
>> character you want to
>> >replace?
>> >cheers,
>> >mortb
>> >
>> >"anonymous" <an*******@discussions.microsoft.com>
wrote
>> in message
>> >news:46****************************@phx.gbl...
>> >I tried both versions, but it still doesnt work. The thing
>> >is that I am reading the following rss
>> >(http://pluralsight.com/blogs/dbox/Rss.aspx) and
creating
>> >the file with the description of the item. The file
>> >contains only the description with the strange chars. Here
>> >is my complete code:
>> >
>> >Dim reader As New XmlTextReader
>> >("http://pluralsight.com/blogs/dbox/Rss.aspx")
>> >Dim xmlDoc As New XmlDocument
>> >
>> >xmlDoc.Load(reader)
>> >
>> >Dim nodes As XmlNodeList = xmlDoc.SelectNodes
>> >("/rss/channel/item")
>> >dim i as integer = 0
>> >
>> >For Each node As XmlNode In nodes
>> >Try
>> > strPost = node("description").InnerXml
>> > Dim c as char = Chr(194)
>> > strPost = strPost.Replace("Ãf,", "XX")
>> > Dim fp As StreamWriter
>> > dim strfile as string = Server.MapPath
("xml_news//")
>> > strfile = strfile & i.tostring()
>> > strfile = strfile & ".asp"
>> > fp = File.CreateText(strfile)
>> > fp.WriteLine("<p>" & Server.HtmlDecode(strPost)
>> >& "</p>")
>> > fp.close()
>> >Catch ex As Exception
>> > Response.Write(ex.Message() & "<br>")
>> >End Try
>> >i = i + 1
>> >Next
>> >
>> >Thanks for any help.
>> >
>> >>-----Original Message-----
>> >>The "replace" needs either two characters or two
strings.
>> >In your case, try:
>> >>
>> >> Dim c As Char = Chr(194)
>> >> str = str.Replace(c.ToString, "")
>> >>
>> >>Or why not just str.replace("Ãff,", "")?
>> >>
>> >>Bill
>> >>
>> >>"anonymous" wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I need to replace this char Ãff, with another char.
>> >>> However I am not able to acieve this. I tried this but
>> >it
>> >>> doesnt work:
>> >>>
>> >>> str = str.Replace(chr(asc(194)), "")
>> >>>
>> >>> Can somebody help ?
>> >>>
>> >>.
>> >>
>> >
>> >
>> >.
>> >
>>
>.
>

.

Nov 18 '05 #13

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

Similar topics

3
by: Q. John Chen | last post by:
It should be easy but I am not familier with javascript. I have a string that is encoded simply by replacing the letter with the next letter in the alphabeta. I need a function to convert it...
7
by: VMI | last post by:
If I have the string "Héllo", how can I replace char (é) with an 'e'? I cannot use the String.Replace() fuction. It has to be by replacing one char with another. Thanks.
12
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: ...
15
by: roberts.noah | last post by:
Are there any decent benchmarks of the difference between using c strings and std::string out there? Google isn't being friendly about it. Obviously this would be dependant on different...
35
by: jacob navia | last post by:
Hi guys! I like C because is fun. So, I wrote this function for the lcc-win32 standard library: strrepl. I thought that with so many "C heads" around, maybe we could improve it in a...
32
by: FireHead | last post by:
Hello C World & Fanatics I am trying replace fgets and provide a equavivalant function of BufferedInputReader::readLine. I am calling this readLine function as get_Stream. In the line 4 where...
10
by: vignesh4u | last post by:
I am trying to implement the Split function in C ie. if i have a string: char* S="This is a test"; and if i try to split based on space ' ' it should return an array of strings like: ...
7
by: DarthBob88 | last post by:
I have to go through a file and replace any occurrences of a given string with the desired string, like replacing "bug" with "feature". This is made more complicated by the fact that I have to do...
4
by: Paul Brettschneider | last post by:
Hello all, consider the following code: typedef char T; class test { T *data; public: void f(T, T, T); void f2(T, T, T);
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...
1
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.