This tool is a work-in-progress which allows you to download single webpages into an all-in-one format. Images, stylesheets and external javascripts are requested and encoded right into the HTML page so no external files are required. Save pages for emailing, burning to offline media or printing later; the page will still look just like the original!
Are you serving your pages in UTF-8 and want to include some characters other than those your keyboard can give? Unless you have an editor capable of understanding UTF-8, trying to insert these special characters (eg. µ, ä or 中文) as-is causes blank characters or question marks to appear. This tool will take whatever characters you supply and serve them back encoded in UTF-8, easily copied and pasted into your own HTML documents.
Want to paste special characters into documents which don't use a UTF-8 charset?
Then you'll need to use HTML entities like these: µ
, ä
or 中文
.
This tool will also allow you to translate any string of characters into HTML entities which should display the proper characters in any charset.
Built for use in the Orca Forum and Blog, the htmlwrap()
function safely wraps HTML formatted text by breaking strings of characters over a certain length.
It's great for use anywhere where generated HTML output is built from user input.
htmlwrap()
won't insert line-breaks within HTML tags or entities, and entities are all treated as single characters when calculating break-points.
It will also try to find logical line-break insertion points (like after periods or slashes) instead of pounding them in robotically every certain number of characters.
Additionally, you can protect entire elements from line-breaks just by adding it to the protect list.
Now optionally works on multi-byte characters in version 1.1!
data:
URL encoderThe newest browsers supporting the latest CSS allow you to do something amazing: embedding images in CSS files. You do this by translating an image file into base64 and letting the browser build the image as it parses your stylesheet. Now you can distribute stylesheets without bundling them with separate graphics and background files! Just use this Binary file to Base64 translator and paste the output into your CSS or XML file as shown and you'll have instant embedded images.
In PHP, in order to create an image box big enough to hold a selection of text, you use the function imagettfbbox()
.
However, for some complex fonts, the box isn't always perfect.
Descenders might be cut off, or there could be a big space to the right of the end of the text.
Angles are especially troublesome to deal with.
The Auto-trim script allows you to create an image from text which is trimmed to a specified border width before sending the result to the browser.
This means your images are always the smallest they can be without chopping off any text bits.
The script accepts many optional $_GET
values, like point size, text colour, and background colour.
Other values like angle, and x/y-squeeze can be set within the script itself.
Version 1.3 changes the way the initial box dimensions are calculated which makes the script faster in most situations, and avoids some problems with multi-line texts.
These days, I use separate encoded text files for languages; one using UTF-8 and one using the traditional character encoding of the text. In the past, I translated the traditionally encoded text to UTF-8 on the fly, which only required one language file, but turned out to be too much of a hassle to keep up. Nevertheless, the recoding functions I translated into PHP from the original Perl module NexTrieve::UTF8, turned out to be useful in their own right.
There do exist PHP functions which convert any character encoding to any other with ease. However, because they're new, and/or require special compiled modules to use, they aren't always available to everyone. The functions below rely on basic low-level byte-by-byte conversion.