# NAME Encode::Wide - Convert wide characters (Unicode) into HTML or XML-safe ASCII entities # SYNOPSIS use Encode::Wide qw(wide_to_html wide_to_xml); my $html = wide_to_html(string => "Café déjà vu – naïve façade"); # returns: 'Café déjà vu – naïve façade' my $xml = wide_to_xml(string => "Café déjà vu – naïve façade"); # returns: 'Café déjà vu – naïve façade' # DESCRIPTION Encode::Wide provides functions for converting wide (Unicode) characters into ASCII-safe formats suitable for embedding in HTML or XML documents. It is especially useful when dealing with text containing accented or typographic characters that need to be safely represented in markup. The module offers two exportable functions: - `wide_to_html(string =` $text)> Converts Unicode characters in the input string to their named HTML entities if available, or hexadecimal numeric entities otherwise. Common characters such as \`é\`, \`à\`, \`&\`, \`<\`, \`>\` are converted to their standard HTML representations like \`&eacute;\`, \`&agrave;\`, \`&amp;\`, etc. - `wide_to_xml(string =` $text)> Converts all non-ASCII characters in the input string to hexadecimal numeric entities. Unlike HTML, XML does not support many named entities, so this function ensures compliance by using numeric representations such as \`&#xE9;\` for \`é\`. # PARAMETERS Both functions accept a named parameter: - `string` — The Unicode string to convert. # ENCODING Input strings are expected to be valid UTF-8. If a byte string is passed, the module will attempt to decode it appropriately. Output is guaranteed to be pure ASCII. # EXPORT None by default. Optionally exportable: wide_to_html wide_to_xml # SEE ALSO [HTML::Entities](https://metacpan.org/pod/HTML%3A%3AEntities), [Encode](https://metacpan.org/pod/Encode), [XML::Entities](https://metacpan.org/pod/XML%3A%3AEntities), [Unicode::Escape](https://metacpan.org/pod/Unicode%3A%3AEscape) # AUTHOR Nigel Horne # COPYRIGHT AND LICENSE Copyright (C) 2025 Nigel Horne This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.