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
12 2603
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*******@disc ussions.microso ft.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(re ader) >> > >> >Dim nodes As XmlNodeList = xmlDoc.SelectNo des >> >("/rss/channel/item") >> >dim i as integer = 0 >> > >> >For Each node As XmlNode In nodes >> >Try >> > strPost = node("descripti on").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.HtmlDeco de(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.T oString, "") >> >> >> >>Or why not just str.replace("Ãf f,", "")? >> >> >> >>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 ? >> >>> >> >>. >> >> >> > >> > >> >. >> > >> >. > .
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  '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 nonbreakingspaces ( ascii 160), which the htmldecode is turning into asc 194. I'mguessing 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 happenson the rss end, or maybe in your textreader. Anyway, I'm not familiar withgrabbing a feed the way you're doing it, so can't offer much more. Hopefullythis 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*******@disc ussions.microso ft.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(re ader) >> > >> >Dim nodes As XmlNodeList = xmlDoc.SelectNo des >> >("/rss/channel/item") >> >dim i as integer = 0 >> > >> >For Each node As XmlNode In nodes >> >Try >> > strPost = node("descripti on").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.HtmlDeco de(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.T oString, "") >> >> >> >>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 ? >> >>> >> >>. >> >> >> > >> > >> >. >> > >> >. > .
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*******@disc ussions.microso ft.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(re ader) >> > >> >Dim nodes As XmlNodeList = xmlDoc.SelectNo des >> >("/rss/channel/item") >> >dim i as integer = 0 >> > >> >For Each node As XmlNode In nodes >> >Try >> > strPost = node("descripti on").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.HtmlDeco de(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.T oString, "") >> >> >> >>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 ? >> >>> >> >>. >> >> >> > >> > >> >. >> > >> >. > .
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 back.
Following is the function:
function cnvtBack(encoded)
{
var orig = "";
for (i=0; i < encoded.length; i++)
|
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.
|
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:
<gibberish>file//g:\pathtofile1<gibberish>file//g:\pathtofile2<gibberish>
etc.
I want to remove the "g:\" from the file paths. I wrote a console app that
successfully reads the file and writes a duplicate of it, but fails for some
reason to do the "replacing" of the "g:\". The code...
|
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 implementations but
I don't care. I would be happy to find ANY comparison at this point if
it was valid and semi scientifically done.
|
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 collective brainstorming session.
Let's discuss some C here, for a change :-)
| |
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 default_buffer_length is changed from 4 --24 code
works fine.
But on the same line if I change the value of default_buffer_length
from 4 --10 and I get a memory error.
And if the change the value of the same variable from 4 --1024 bytes;
|
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:
{"This","is","a","test"} .
I tried to implement it as given below but am getting a segmentation
fault. I would really appreciate if some one could give me an answer
on this issue:
|
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 this with
a lot of replacements and by the fact that some of the target strings
are two words or more long, so I can't just break up the file at
whitespace, commas, and periods. How's the best way to do this? I've
thought about using strstr() to...
|
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);
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without 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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |