Uniface User Forum

 View Only

Converting plain text to an HTML tagged string

  • 1.  Converting plain text to an HTML tagged string

    Posted 05-02-2022 09:08
    Edited by Gianni Sandigliano 05-03-2022 02:32

    Hi Unifacers,

    What is the smartest way to convert plain text into an HTML tagged format via ProcScript only?

    In our case "plain text" means a text containing any word/character from languages: Italian, French, Spanish but also from any other nation around the Mediterranean Sea: Morocco, Turkey, Greece, Slovenia, Albania, Israel, Egypt, and so on ... so I can easily say any known language except Far Eastern languages.

    It doesn't seem to me that Uniface has a built-in function and even Javascript requires you to build an entire document and then extract the internal body.

    At the moment we've built a simple Uniface function converting:
    - Double Carriage Return to HTML paragraph
    - Single Carriage Return to LineBreak
    - Basic HTML entities (ampersand, greaterThan, lesserThan) to corresponding codes
    - All Other HTML entities to corresponding codes

    Thanks in advance for any tip / trick / suggestion!

    Regards,
    Gianni

    P.S. The issue initially mentioned related to these specific listed characters was solved using $string().

    By the way a couple of characters CANNOT be directly included in the function code because they generate compilation error; they are:
    ; - from table ISO-8859-1 Symbols characters: (#173) Soft hyphen, (#174) Registered trademark, (#175) Spacing macron, (#176) Degree, (#177) Plus or minus, (#178) Superscript 2
    ; - from table Miscellaneous HTML entities characters: (#8204) Zero width non-joiner, (#8205) Zero width joiner, (#8206) Left-to-right mark, (#8207) Right-to-left mark

    I suppose those 9+1 characters are used internally from Uniface Development to manage GOLD search profiles. Am I right?


    ------------------------------
    Gianni Sandigliano
    IT
    ------------------------------