Terminal control/Unicode output: Difference between revisions

Add Mercury.
(Omit Axe)
(Add Mercury.)
Line 267:
<lang Mathematica>If[StringMatchQ[$CharacterEncoding, "UTF*"], Print[FromCharacterCode[30000]], Print["UTF-8 capable terminal required"]]
->田</lang>
 
=={{header|Mercury}}==
<lang mercury>:- module unicode_output.
:- interface.
 
:- import_module io.
 
:- pred main(io::di, io::uo) is det.
 
:- implementation.
 
:- import_module list.
:- import_module maybe.
:- import_module string.
 
main(!IO) :-
list.map_foldl(io.get_environment_var, ["LANG", "LC_ALL", "LC_CTYPE"], EnvValues, !IO),
( if
list.member(EnvValue, EnvValues),
EnvValue = yes(Lang),
string.sub_string_search(Lang, "UTF-8", _)
then
io.write_string("Unicode is supported on this terminal and U+25B3 is : \u25b3\n", !IO)
else
io.write_string("Unicode is not supported on this terminal.\n", !IO)
).</lang>
Output:
<pre>Unicode is supported on this terminal and U+25B3 is : △</pre>
 
=={{header|Nemerle}}==
Typically, on a windows system, the output encoding is '''not''' UTF-8, so in an actual application it would make more sense to set <tt>Console.OutputEncoding</tt> than to merely check it.
Anonymous user