Pasting hyperlinks

General TRichView support forum. Please post your questions here
Post Reply
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Pasting hyperlinks

Post by martindholmes »

Hi there,

I have a problem when text containing hyperlinks is pasted from OpenOffice. I copy something like this:

This is a test

http://hotpot.uvic.ca/

Finished.

where the middle line is a link to the visible URL. In my TRichViewEdit, I see the text of the link interspersed with square-box characters (the way WideStrings sometimes appear when they are pasted into an 8-bit text box). If I copy/paste from the TRichViewEdit, the text is OK again (so I can't paste it here!). The URL of the link is correctly preserved. My OnPasteHyperlink looks like this:

procedure TMarkRichView.RVEReadHyperlink(Sender: TCustomRichView; const Target,
Extras: string; DocFormat: TRVLoadFormat; var StyleNo, ItemTag: Integer;
var ItemName: string);
begin
ItemTag := Integer(StrNew(PChar('href="' + Target + '"')));
StyleNo := tsHyperlink;
end;

It looks as though the actual text of the item, which is Unicode, is being treated as if it's not Unicode. Do you have any idea what might be causing this, or how I can avoid it?

Cheers,
Martin
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Post by martindholmes »

Just discovered the same thing happens when I load an RTF document containing a link -- example here:

http://www.mholmes.com/test_link_loading.rtf

Screenshot of the result when loading into TRichViewEdit here:

http://www.mholmes.com/screenshot.png

This is obviously a Unicode issue, but I don't know what could be causing it.

All help appreciated,
Martin
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Post by martindholmes »

My own stupid fault!

My hypertext style had Unicode = False.

Sorry for the wasted bandwidth.

Doh!

Cheers,
Martin
Post Reply