The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::Basis::ConvertText2::UtfTransform

SYNOPSIS

    use 5.10.0 ;
    use strict ;
    use warnings ;
    use App::Basis::ConvertText2::UtfTransform

    my $string = "<b>bold text</b> 
        <i>italic text</i>
        <f>flipped upside down text and reversed</f>
        <l>Some Leet speak</l>
        <o>text in bubbles</o>
        <s>script text</s>
        <l>are you leet</l>" ;

    say utf_transform( $string) ;

    my $smile = ":beer: is food!  :) I <3 :cake: ;)" ;

    say uttf_smilies( $smile ) ;

DESCRIPTION

A number of popular websites (eg twitter) do not allow the use of HTML to create bold/italic font effects or perform smily transformations

However we can simulate this with some clever transformations of plain ascii text into UTF8 codes which are a different font and so effectively create the same effect.

We have transformations for flip (reverses the string and flips upside down, bold, italic, bubbles and leet.

We can transform A-Z a-z 0-9 and ? ! ,

I have only implemented a small set of smilies, ones that I am likely to use

Note

You cannot embed one format within another, so you cannot have bold script, or bold italic.

See Also

http://txtn.us/

Functions

utf_transform

transform A-ZA-z0-9!?, into UTF8 forms suitable for websites that do not allow HTML codes for these

we use the following psuedo HTML elements

    flip     <f>text</f>      upside down and reversed
    bold     <b>text</b>
    italic   <i>text</i>
    bubbles  <o>text</o>
    script   <s>text</s>
    leet     <l>text</l>      LeetSpeak

Parameters

incoming string

Returns

transformed string

utf_smilies

transform some character strings into UTF smilies

I have only implemented a small set of smilies, ones that I am likely to use

    | smilie                    | symbol      |
    |---------------------------+-------------|
    | <3. :heart:               | heart       |
    | :)                        | smile       |
    | :D                        | grin        |
    | 8-)                       | cool        |
    | :P                        | pull tongue |
    | :(                        | cry         |
    | :(                        | sad         |
    | ;)                        | wink        |
    | :halo:                    | halo        |
    | :devil:, :horns:          | devil horns |
    | (c)                       | copyright   |
    | (r)                       | registered  |
    | (tm)                      | trademark   |
    | :email:                   | email       |
    | :yes:                     | tick        |
    | :no:                      | cross       |
    | :beer:                    | beer        |
    | :wine:, :wine_glass:      | wine        |
    | :cake:                    | cake        |
    | :star:                    | star        |
    | :ok:, :thumbsup:          | thumbsup    |
    | :bad:, :thumbsdown:       | thumbsup    |
    | :ghost:                   | ghost       |
    | :skull:                   | skull       |
    | :hourglass:               | hourglass   |
    | :time:                    | watch face  |
    | :sleep:                   | sleep       |

Parameters

incoming string

Returns

transformed string