Recent

Author Topic: Is there a function to convert text with control characters to a single line?  (Read 13160 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Is there a function to convert text with control characters to a single line?
« Reply #15 on: September 19, 2014, 03:04:04 pm »
Note: UnescapeHTML still has a bug in it. Dang!

Result := StringsReplace(result,['&amp;','&lt;','&gt;','&quot;','&apos;','''],['&','<','>','"',#39,#39],[rfReplaceAll]);
-----------------------------------^ BUG

Whats the bug?

Could it be cause you are using 'result' without assigning a value to it first, or using a different variable instead?
Lazarus 3.0/FPC 3.2.2

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Is there a function to convert text with control characters to a single line?
« Reply #16 on: September 19, 2014, 04:24:25 pm »
Note: UnescapeHTML still has a bug in it. Dang!

Result := StringsReplace(result,['&amp;','&lt;','&gt;','&quot;','&apos;','''],['&','<','>','"',#39,#39],[rfReplaceAll]);
-----------------------------------^ BUG

Whats the bug?

Could it be cause you are using 'result' without assigning a value to it first, or using a different variable instead?

LOL, yes that's definitely a bug.  I missed that completely.   Not my code though, I copied that directly from the Lazarus source.  I'll see if there's an item on this in Mantis, if not, I'll open one...
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Is there a function to convert text with control characters to a single line?
« Reply #17 on: September 20, 2014, 02:37:36 pm »
LOL, yes that's definitely a bug.  I missed that completely.   Not my code though, I copied that directly from the Lazarus source.  I'll see if there's an item on this in Mantis, if not, I'll open one...

Fixed in Trunk:  http://bugs.freepascal.org/view.php?id=26746  (Thanks @Marco)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Is there a function to convert text with control characters to a single line?
« Reply #18 on: September 20, 2014, 03:43:08 pm »
LOL, yes that's definitely a bug.  I missed that completely.   Not my code though, I copied that directly from the Lazarus source.  I'll see if there's an item on this in Mantis, if not, I'll open one...

Fixed in Trunk:  http://bugs.freepascal.org/view.php?id=26746  (Thanks @Marco)

That was quick, only that I just compiled Rev 28697 earlier this morning.

Now how would I go updating it quickly and easily? Is it just a matter of running svn update in the source tree and recompiling?

I am using fpcup
Lazarus 3.0/FPC 3.2.2

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Is there a function to convert text with control characters to a single line?
« Reply #19 on: September 20, 2014, 04:00:58 pm »
It's alway a dance recompiling FPC.   Well, a three step dance, but I can never remember the three steps.  I'm lazy.  I just re-run fpcup :-)

Search the forums for recompiling fpc.  There's question have been asked many times, once by myself.  I think I was missed the last step - "make install".  Something like that...
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

 

TinyPortal © 2005-2018