Creating a new Unicode window
Unicode windows are windows which contain text, yet they are not AppleScript terminal windows. Unicode windows' background is a very light grey. In Unicode windows, you can edit Unicode files, in particular XML files: for instance XHTML files written as Unicode, or plist files.
Unicode is an encoding of each character into a unique (possibly large) number which makes it possible to represent all existing characters, including non-latin, chinese, or Klingon characters.
The Action menu in Unicode windows
To make a new Unicode window, select File ▸ New ▸ New Unicode text. Any document whose file extension describes a text file will open in a Unicode window, unless the 4-characters file's type (in the Mac OS sense) is "ut16".
Whatever a file's type and file extension, you can force Smile to open it as text with the File ▸ Open Finder selection menu item.
If you select the menu item with the shift key (⇧) pressed, the file will open in a new Unicode text window.
If you select the menu item with the alt key (⌥) pressed, the file will open in a new [Mac] text window, that is, in a new AppleScript terminal window.
The Action menu for a Unicode window performs some actions on the contents of the window. Those actions can be customized. Default behavior depends on the extension of the opened file:
- The Action ▸ Check syntax menu (shortcut: ^⌘R) checks the document validity relatively to its kind: it checks the xml syntax of an xml document, or it checks a specific syntax for files whose extension is .strings, .js, .css, .dtd, .rng. CSS validation requires an internet connexion.
- The Action ▸ Validate menu (shortcut: ⌥⌘R) checks the validity of the XML with respect to its DTD, or it checks a specific validity for files whose extension is .plist, .xsd.
- The Action ▸ Execute menu (shortcut: ⌘R) displays the result in a web window for files whose extension is .html, .htm, .sdef, or if the XML declares an xslt stylesheet in a processing instruction.
Using CR or LF characters
Saving a Unicode window makes a UTF-8 or a UTF-16 file according to the option you select in the window's toolbar. In the Unicode windows you can enter non Roman characters, and you can use the International menu and the Characters Palette. Unicode windows have no text style: you can only change the text style (font etc.) for the window as a whole.
The CR/LF toolbar menu specify whether the return key enters carriage return (CR, ASCII 13) or line feed (LF, ASCII 10). When you toggle this menu, you are prompted to change all existing returns into the new mode.
Be aware that most XML processors needs LF to work properly. To ensure that your text only contains LF characters, click the LF toolbar item. If you have some remaining CR characters, you will be prompted for their substitution.