Mac to ISO

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11 (Modified)


Mac to ISO (text) String

ParameterTypeDescription
textStringText expressed using Mac OS ASCII map
Function resultStringText expressed using standard Web character set

Compatibility Note: This command only works when the database is executed in ASCII compatibility mode. In Unicode mode, it does nothing (the text string is returned without modification). Beginning with version 11 of 4D, this command is thus obsolete and its use is no longer recommended. It is recommended to convert character strings using the CONVERT FROM TEXT or Convert to text commands.

Description

The Mac to ISO command returns text equivalent to that passed in text, but expressed using the Web characters table found in the Standard Set menu of the Web/Options page in the application Preferences.

You will generally not need to use this command.

This command expects a text parameter expressed using the Mac OS ASCII map.

4D converts characters received from and sent to a Web Browser. As a result, the text values you deal with, inside a Web Connection process, are always expressed using the Mac OS ASCII map.

Generally, when running on Windows, you do not need to convert ASCII codes. In ASCII compatibility mode (non-Unicode), when you copy or paste text between 4D and Windows or when you import or export data, 4D automatically performs these conversions. However, when you use disk read/write commands such as SEND PACKET or RECEIVE PACKET, you need to explicitly invoke ASCII conversions.

Within 4D, all the text values, fields, or variables that you have not yet converted to another ASCII map are Mac OS-encoded on both Macintosh and Windows. For more information, see the ASCII Codes section.

On Windows, it is necessary that, in this case, you do not filter the characters using an output filter ASCII map.

Consequently, no matter what the platform, if you want to write ISO Latin-1 HTML documents or documents using other Web character sets on disk, you just need to convert the text using Mac to ISO. This is the main purpose of the Mac to ISO command.

Examples

1. The following line of code converts by default the (assumed) Mac OS encoded text stored in vtSomeText into an ISO-Latin 1 encoded text:

   vtSomeText:=Mac to ISO(vtSomeText)

2. While developing a 4D Web Server application, you build HTML documents that you later send over Intranet or Internet, using the SEND HTML FILE command. Some of these documents have references or links to other documents.

The following project method calculates an HTML-based pathname from the Windows or Macintosh pathname received as parameter:

      ` HTML Pathname project method
      ` HTML Pathname ( Text ) -> Text
      ` HTML Pathname ( Native File Manager Pathname ) -> HTML Pathname

   C_TEXT($0;$1)
   C_LONGINT($vlChar;$vlAscii)
   C_STRING(31;$vsChar)

   $0:=""
   If (On Windows )
      $1:=Replace string($1;"\";"/")
   Else 
      $1:=Replace string($1;":";"/")
   End if 
   $1:=Mac to ISO($1)
   For ($vlChar;1;Length($1))
      $vlAscii:=Character code($1[[$vlChar]])
      Case of 
         : ($vlAscii>=127)
            $vsChar:="%"+Substring(String($vlAscii;"&$");2)
         : (Position(Char($vlAscii);":<>&%= "+Char(34))>0)
            $vsChar:="%"+Substring(String($vlAscii;"&$");2)
      Else 
         $vsChar:=Char($vlAscii)
      End case 
      $0:=$0+$vsChar
   End for 

Note: The On Windows project method is listed in the System Documents section.

Once this project method is present in your database, if you want to include a list of FTP links to documents present in a particular directory, you can write:

      ` Interprocess variables set, for instance, in the On Startup database method
   <>vsFTPURL:="ftp://123.4.56.78/Spiders/"
   <>vsFTPDirectory:="APS500:Spiders:" ` Here, a Mac OS File Manager pathname
      ` ...

      ` ...
   ARRAY STRING(31;$asDocuments;0)
   DOCUMENT LIST(...;$asDocuments)
   $vlNbDocuments:=Size of array($asDocuments)
   jsHandler:=...
   For ($vlDocument;1;$vlNbDocuments)
      vtHTMLCode:=vtHTMLCode+"<P>Char(34)+<>vsFTPURL
                                    +HTML Pathname (Substring($1+$asDocuments{$vlDocument};
                                       Length(<>vsFTPDirectory)+1))+Char(34)+jsHandler+"> "
                                          +$asDocuments{$vlDocument}+"</P>"+Char(13)
   End for
      ` ...

See Also

ASCII Codes, ISO to Mac, SEND HTML FILE, SEND PACKET, USE CHARACTER SET.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next