Terminal control/Unicode output: Difference between revisions
Content added Content deleted
(added Elixir) |
(jq) |
||
Line 180: | Line 180: | ||
UTF supported: △ |
UTF supported: △ |
||
</pre> |
</pre> |
||
=={{header|jq}}== |
|||
{{Works with |jq|>1.4}} |
|||
The jq "env" function is required to inspect environment variables. It is NOT available in jq version 1.4. |
|||
Note also that "The values of locale categories are determined by a precedence order ..." |
|||
-- http://pubs.opengroup.org/onlinepubs/007908799/xbd/envvar.html |
|||
"has_unicode_support" therefore cannot simply test whether one of the variables LC_ALL, LC_TYPE and LANG contains the string UTF. |
|||
<lang jq>def has_unicode_support: |
|||
def utf: if . == null then false else contains("UTF") or contains("utf") end; |
|||
env.LC_ALL |
|||
| if utf then true |
|||
elif . != null and . != "" then false |
|||
elif env.LC_CTYPE | utf then true |
|||
else env.LANG | utf |
|||
end ; |
|||
def task: |
|||
if has_unicode_support then "\u25b3" |
|||
else error("HW65001 This program requires a Unicode-compatible terminal") |
|||
end ; |
|||
task</lang> |
|||
{{Out}} |
|||
$ jq -M -r -n -f Terminal_control.jq |
|||
jq: error: HW65001 This program requires a Unicode-compatible terminal |
|||
# In a galaxy not far away: |
|||
$ jq -M -r -n -f Terminal_control.jq |
|||
△ |
|||
=={{header|Lasso}}== |
=={{header|Lasso}}== |