By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,142 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,142 IT Pros & Developers. It's quick & easy.

Replacing char

P: n/a
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
Share this Question
Share on Google+
12 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.