Ticket #556 (assigned enhancement)

Opened 3 years ago

Last modified 1 year ago

AS: Text to or from HTML conversion routines & functions

Reported by: Niteshade Assigned to: timothy (accepted)
Priority: high Component: AppleScript Support
Version: Latest Nightly Severity: normal
Keywords: HTML text & display bug convert Cc: hennk

Description

Because Colloquy requires HTML text, it has problems displaying some normal text characters in the window (eg &) and it just sends a blank line. The text must be "converted" to HTML OK text - where e.g. & is changed to & There are a lot of other odd characters that may need to be changed because, if they are present, they will probably similarly screw up the display of the whole line.

It would be nice if there was a built in Applescript routine that can be called to translate lines of text to and from HTML. All the HTML characters would be translated - http://rabbit.eng.miami.edu/info/htmlchars.html

Maybe a more powerful version would also have the option of converting other IRC characters (eg. ctrl-b) into HTML compatible text (<b></b>)

Such a basic funtion would 1. be so useful, 2. be reliable in converting ALL troublesome characters (vs a user created routine), and 3. protect against bugs/errors in display, that I set this ticket to a high priority.

Cheers

Niteshade

Change History

03/25/06 15:01:07 changed by timothy

  • status changed from new to assigned.

06/08/06 01:48:52 changed by brennan@young.net

This is certainly a problem, although I am not sure about the exact solution.

AppleScript? is quite slow when processing strings, and I would certainly argue that any special text conversions required by Colloquy (such as escaping the & character) should be handled by compiled cocoa routines.

Building a string containing HTML tags is tortuously slow. It would be good to have this handled faster somehow, but maybe it's a job for 'do shell script'.

06/08/06 01:54:59 changed by timothy

I agree with brennan.

(follow-up: ↓ 5 ) 02/07/07 06:54:17 changed by akempgen

  • component changed from Colloquy (GUI) to AppleScript Support.

there should probably two plugin functions: one that has rich text (or plain text with irc control chars if thats not the same) as a param and return value, and is called before colloquy converts it to html and searches for member links and urls. this would also fix the issues the blowfish plugin has

and one that has html as param and return value. this would obviously called when colloquy is done converting stuff to html.

not sure if this just applies to AS or other languages as well

(in reply to: ↑ 4 ) 02/11/07 11:59:41 changed by hennk

Replying to akempgen:

there should probably two plugin functions: one that has rich text (or plain text with irc control chars if thats not the same) as a param and return value, and is called before colloquy converts it to html and searches for member links and urls. this would also fix the issues the blowfish plugin has

I am developing a Blowfish plugin as an ObjC plugin based on the irssi-plugin from http://fish.sekure.us . I've ran into the same problems as the AS plugin (ie. no processing of the decrypted messages like nick/url detection). Another problem seems to be the encoding of the message. Right now I have to supply either an NSString or HTML, but I need a guess for the correct encoding for both. So for encryption plugins I think the best would be to simply work on some NSData, and leave everything regarding interpreting the message up to Colloquy. This would then require a third plugin method, called even before Colloquy starts to decode the actual content of the incoming message into NSStrings or something similarly higher-level.

and one that has html as param and return value. this would obviously called when colloquy is done converting stuff to html. not sure if this just applies to AS or other languages as well

This applies to all languages, but I am not sure about the right component. Would that be Generic Script Support, then?

02/11/07 12:16:53 changed by hennk

  • cc set to hennk.

06/21/07 10:57:49 changed by Brennan

/nod - yes it sounds like Generic Script Support should handle this.

For those using AppleScript?, you could do worse than

http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.10.htm