Jump to content

Unicode strings: Difference between revisions

no edit summary
m (→‎{{header|Mathematica }}: fix header markup)
No edit summary
Line 895:
 
[[File:Unicode print locomotive basic.png]]
=={{header|M2000 Interpreter}}==
* How easy is it to present Unicode strings in source code?
 
We copy them in M2000 editor. Internal M2000 use UTF16LE but programs saved in UTF-8 format.
 
* Can Unicode literals be written directly, or be part of identifiers/keywords/etc?
 
Yes
 
* How well can the language communicate with the rest of the world?
 
GUI support unicode. We can use filenames with names from any language. Text files are UTF-16LE or Ansi (we can use WIDE for specify UNICODE, also we can specify the locale for ANSI), and we can load/Save Document object using UTF-8, UTF-16LE, UTF-16BE and ANSI (we can specify the locale). Clipboard is unicode also.
 
* Is it good at input/output with Unicode?
 
If we use proportional text we are ok, byt simple text output/input to console break each word to letter and then send it to console, so we get always a left to right output. We can use diacritical marks combining to same letter.
 
* Is it convenient to manipulate Unicode strings in the language?
 
Strings are same as Visual Basic 6 strings (M2000 Interpreter written in VB6). We can get the length of a string as display length wich calculate diacritical marks.
 
* How broad/deep does the language support Unicode?
 
From variables/keys to files and screen/printer output. Also we can use external COM objects using unicode strings,
 
* What encodings (e.g. UTF-8, UTF-16, etc) can be used?
 
A string may contain a one byte char array or a two byte char array. The Len() function always return the two byte length, so 3 bytes string return a length of 1.5. Encoding is not bound to string but with function which process the string. So there are functions to process in UTF-16LE, other to process in ANSI, and one function for conversions from and to UTF-8. UTF-16BE supported only for loading/Saving a document object (internal is always in UTF16-LE)
 
* Does it support normalization?
 
No. A string may contain any value including zero. Max size is 2GB. Also we can make strings in buffers with specific length, and any value.
 
 
<lang M2000 Interpreter>
Font "Arial"
Mode 32
' M2000 internal editor can display left to rigtht languages if text is in same line, and same color.
a$="لم أجد هذا الكتاب القديم"
' We can use console to display text, using proportional spacing
Print Part $(4), a$
Print
' We can display right to left using
' the legend statement which render text at a given
' graphic point, specify the font type and font size
' and optional:
' rotation angle, justification (1 for right,2 for center, 3 for left)
'quality (0 or non 0, which 0 no antialliasing)
' letter spacing in twips (not good for arabic language)
move 6000,6000
legend a$, "Arial", 32, pi/4, 2, 0
' Variables can use any unicode letter.
' Here we can't display it as in M2000 editor.
' in the editor we see at the left the variable name
' and at the right the value
القديم=10
Print القديم+1=11 ' true
</lang>
=={{header|Mathematica}}==
Mathematica supports full Unicode throughout -- in strings, symbols, graphics and external operations -- allowing immediate streamlined use of all standard international character sets, integrated with native text entry.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.