Terminal control/Unicode output: Difference between revisions

m
→‎{{header|Tcl}}: note on what's happening
(→‎Tcl: Added implementation)
m (→‎{{header|Tcl}}: note on what's happening)
Line 34:
=={{header|Tcl}}==
Tcl configures the standard output channel to use the system encoding by default. The system encoding is formally the encoding for use when communicating with the OS (e.g., for filenames) but is virtually always correlated with the default terminal encoding.
<lang tcl># Check if {[stringwe're matchusing utf-*one [encodingof system]]the ||UTF [stringor match *"unicode* [encoding system]]}" {encodings
if {[string match utf-* [encoding system]] || [string match *unicode* [encoding system]]} {
puts "\u25b3"
} else {
error "terminal does not support unicode (probably)"
}</lang>
Note that idiomatic Tcl code would not perform such a check; it would just produce the output which would be translated as best as possible (possibly into the target encoding's placeholder character).
 
=={{header|UNIX Shell}}==
Anonymous user