|
|||||||
Tech: HtmlEsc.java: Convert special chars Related threads: Mudcat HTML Guide PermaThread (64) tech: HTML Ampersand Codes (33) Tech: Non-ASCII character display problems (47) (closed) Tech: Entering special characters (moderated) (18) Tech: CopyUnicode: Create any char (17) Tech - ALTKEY Codes on Laptop (28) HTML Stuff II (126) Tech: htmlesc.py: Mac script to escape text (12) HTML Tables (19) Clickable Links (14) HTML Beginners Study Guide (3) |
Share Thread
|
Subject: RE: Tech: HtmlEsc.java: Convert special chars From: Artful Codger Date: 03 Jul 11 - 05:25 PM 2011 July 3: New JAR version. JAR updated to remove conversion of ASCII double quotes and single quotes (the "apos" character reference is non-standard). The only change is in the first entry line of the charMapData definition, which should now read (after indentation): "&", "&", "<", "<", ">", ">", |
Subject: RE: Tech: HtmlEsc.java: Convert special chars From: GUEST,Jon Date: 06 Jul 08 - 07:38 AM I've had another look this am. The long delay only happens when I run in debug mode. It didn't seem to be last night but it is reading the clipboard contents (btw if clipboard is empty it throws a null pointer exception) and is converting the text. The setting of the new clipboard contents is random though. It can leave the contents unchanged, empty the clipboard or update correctly. I'll try to have another play another day and see if I can work it out. |
Subject: RE: Tech: HtmlEsc.java: Convert special chars From: Artful Codger Date: 05 Jul 08 - 10:48 PM I don't know what to tell you. I'm only using standard calls. If getClipboard takes that long (before any text is even requested!) it indicates a problem with the Suse/Java interface. I'd be curious whether users on other Linux systems encounter a similar problem. Try this: compile specifying an execution version of 1.5. On Mac at least, the current 1.6 runtime is only available in a 64-bit version. That may somehow be related to the problem. I don't think I've used any constructs that aren't available in v1.5. FWIW, my environment is 1.6.0_05. Another thought is that whatever application you're copying from doesn't actually make the data available on the clipboard, but rather waits to be notified when someone wants the data it offers, in some particular format. I don't do that kind of handshaking on the script end--none of my source apps have failed to put the text directly onto the clipboard. |
Subject: RE: Tech: HtmlEsc.java: Convert special chars From: GUEST,Jon Date: 05 Jul 08 - 06:55 PM I've just tried building it using NetBeans but it isn't working and at least some times it seems to empty the clipboard. GetClipboard takes about 30 seconds to return. rtn in GetText gets set to an empty string (""). OpenSuse 11.0/KDE 4/ java version "1.6.0_06" Java(TM) SE Runtime Environment (build 1.6.0_06-b02) Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode) |
Subject: RE: Tech: HtmlEsc.java: Convert special chars From: Artful Codger Date: 03 Jul 08 - 10:15 PM Script updated 12 Feb 2011 to remove several mnemonics which aren't well-supported: hibar, Zcaron, zcaron and bdquote. The script supplies numeric escapes for these characters instead. -Artful Codger-
|
Subject: Tech: HtmlEsc.java: Convert special chars From: Artful Codger Date: 03 Jul 08 - 10:12 PM Program description updated 12 Feb 2011. HtmlEsc is now available as a downloadable, precompiled JAR file which can be run with just a double-click. The program may still be run from the command line, but this is no longer described. Download from HERE (joeweb) or HERE (my SkyDrive). Last JAR file update: 2011 July 3 (No longer converts ASCII single and double quotes) -Artful Codger- HtmlEsc is a simple Java program to encode text on the clipboard so that, once pasted into Mudcat messages, it will display the same way to all users. It converts all non-ASCII characters to HTML escapes (character references). To understand why this conversion is desirable, see the guide Entering special characters. Basically, if your text contains any characters outside the following list, encode it.
This program is available as a pre-compiled Java JAR file, which should work across all platforms. To download the JAR file, go HERE, select Download, and save the file to your desktop. (Actually, you can save it anywhere and just put a shortcut or alias on your desktop or similar quick-access location.) To use HtmlEsc:
To encode text you've already entered or pasted into the Mudcat message area, you do essentially the same thing: Select your text and copy it to the clipboard. Then double-click the HtmlEsc utility, let it run, then click the browser's title bar (returning focus to the message entry area without clearing the selection) and paste. This should replace the text you just copied with an encoded version. NOTE: Any text styling is stripped, and any embedded HTML tags are treated as literal text. DO NOT run the converter on text which you've already converted, or on text which includes HTML tags. Known problems:
The following message contains the full source code for the utility, in case you need to customize it for your system, or you're just curious how the conversion is performed. If you remove a mnemonic and its preceding value from the big table, that character will be converted to a numeric escape instead (except in the case of &, ", < and >, which would be copied literally--but you can always make their translations numeric). |
Share Thread: |
Subject: | Help |
From: | |
Preview Automatic Linebreaks Make a link ("blue clicky") |