[yunqa.de] Re: TDIHtmlParser.StartPos returns wrong value if a copyright symbol ((c)) is included

  • From: Edwin Yip <edwin.yip@xxxxxxxxxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Mon, 30 Apr 2012 22:53:09 +0800

Hi Ralf,

Sorry, during the composing of a simple project that's intended to
demonstrate the problem, I found that it's not a problem if DIHtmlParser,
but a logic problem of my program - I use Scintilla which uses "byte
positions", and I wasn't aware of this and wrongly assumed it also uses
"character position"... On the other hand, this shows that  DiHtmlParser is
very stable :)

BTW, if you don't mind I'm asking, do you happened to have a function in
your "utility unites" that can convert a "character index" of a Unicode
string A to a "byte index" of a utf8 string B that's corresponding to
string A? Thanks.

On Mon, Apr 30, 2012 at 9:57 PM, Edwin Yip <edwin.yip@xxxxxxxxxxxxxxxxxx>wrote:

> Hi Ralf,
>
> Are StartPos, EndPos 0-based or 1-based?
>
> And StartLine and EndLine ?
>
> Sorry, I couldn't find the info in the document.
>
>
> On Mon, Apr 30, 2012 at 12:27 AM, Edwin Yip 
> <edwin.yip@xxxxxxxxxxxxxxxxxx>wrote:
>
>> I'll try to make a test project for you.
>>
>>
>> On Sun, Apr 29, 2012 at 5:26 PM, Delphi Inspiration <delphi@xxxxxxxx>wrote:
>>
>>> On 27.04.2012 16:57, Edwin Yip wrote:
>>>
>>> > So I think maybe you can just try parsing a unicodeString that contains
>>> > the © copyright symbol, since I'm quite sure the content I pass
>>> > to SetSourceBufferAsStr is correctly encoded into UnicodeString (i.e.
>>> > string in D2010).
>>>
>>> If you are passing from a UnicodeString you should use
>>> TDIHtmlParser.SourceBufferAsStrW() to assign that string to the parser.
>>>
>>> Other than that, I added tests to my test suite that show that the "©"
>>> character is correctly counted into TDIHtmlParser.StartPos and
>>> TDIHtmlParser.EndPos.
>>>
>>> Ralf
>>> _______________________________________________
>>> Delphi Inspiration mailing list
>>> yunqa@xxxxxxxxxxxxx
>>> //www.freelists.org/list/yunqa
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Best Regards,
>> Edwin Yip
>>
>> Mind Mapping is as Effortless as Typing
>> http://www.InnovationGear.com
>>
>
>
>
> --
> Best Regards,
> Edwin Yip
>
> Mind Mapping is as Effortless as Typing
> http://www.InnovationGear.com
>



-- 
Best Regards,
Edwin Yip

Mind Mapping is as Effortless as Typing
http://www.InnovationGear.com

Other related posts: