Recent

Author Topic: Searches; Boyer-Moore-Horspool search algorithm.  (Read 18104 times)

arneolav

  • Full Member
  • ***
  • Posts: 195
    • ElTranslador
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #15 on: January 06, 2014, 11:20:10 pm »
FindInvalidUTF8Character

Deprecated, see #LazUtils.LazUTF8 for replacements.

What exactly is deprecated here?
Lazutf8.FindInvalidUTF8Character certainly isn't AFAIK.

Bart

Just found this:
http://lazarus-ccr.sourceforge.net/docs/lcl/lclproc/findinvalidutf8character.html
Win XP, Win7, Win 10, Win 11, win64 , Lazarus 3.0RC1
Delphi/DevExpress

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #16 on: January 06, 2014, 11:27:20 pm »
It seems that there was/is a function with a similar name FindInvalidUTF8Character in LCLProc unit, and now it is in LazUTF8 unit. Name wise it was moved from one unit to another.

u2o

  • Jr. Member
  • **
  • Posts: 72
  • No message
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #17 on: October 21, 2014, 01:30:57 pm »
The LazUtf8 unit contains this function:
Code: [Select]
function FindInvalidUTF8Character(p: PChar; Count: PtrInt;
                                  StopOnNonASCII: Boolean = false): PtrInt;

You can use that to find out if a string is properly UTF8 encoded (it'll return -1 in that case).

Bart

It seems that there was/is a function with a similar name FindInvalidUTF8Character in LCLProc unit, and now it is in LazUTF8 unit. Name wise it was moved from one unit to another.

After a while I go back to experiment with utf8.

These messages are confusing lot. I haven't defined that the Edit Control is utf8.

The function:

Code: [Select]
LazUTF8.FindInvalidUTF8Character(pchar(Edit8.Text),length(Edit8.Text), False)

always returns -1

My system: Windows 7 x86 language and locale settings: Spanish Argentina.

The only way to get the expected result (for now) is use my method ( http://forum.lazarus.freepascal.org/index.php/topic,23136.msg137798.html#msg137798 ).

Can you explain what happens?
« Last Edit: October 23, 2014, 03:58:48 am by u2o »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #18 on: October 21, 2014, 02:40:56 pm »
A lot of the general lazarus utf8 were moved out of the LCL to lazutils by Felipe so that non lazarus dependent projects (fpspreadsheet etc) could use it.

u2o

  • Jr. Member
  • **
  • Posts: 72
  • No message
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #19 on: October 21, 2014, 04:12:26 pm »
Ok, it's in another unit.

But why returns allways -1 ?

Is a bug?
Is my language and regional settings?
Is the Windows Source DVD on Spanish?

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Searches; Boyer-Moore-Horspool search algorithm.
« Reply #20 on: October 21, 2014, 06:03:44 pm »
But why returns allways -1 ?
Because you are using Edit8.Text which is always a valid UTF8 encoded string. FindInvalidUTF8Character returns -1 is this case.

 

TinyPortal © 2005-2018