4D v13.4

Mac to ISO

Home

 
4D v13.4
Mac to ISO

Mac to ISO 


 

Mac to ISO ( text ) -> Function result 
Parameter Type   Description
text  String in Text expressed using Mac OS ASCII map
Function result  String in Text expressed using standard Web character set

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.

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 oder 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.

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)

While developing a 4D Web Server application, you build HTML documents that you later send over Intranet or Internet, using the WEB SEND 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><A HREF="+Char(34)+◊vsFTPURL+HTML Pathname(Substring($1+$asDocuments{$vlDocument};Length(◊vsFTPDirectory)+1))+Char(34)+jsHandler+"> "+$asDocuments{$vlDocument}+"</A></P>"+Char(13)
 End for
  ` ...

 
PROPERTIES 

Product: 4D
Theme: String
Number: 519

This command is deprecated and should not be used anymoreThe Unicode mode affects this command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

ASCII Codes
ISO to Mac
SEND PACKET
USE CHARACTER SET
WEB SEND FILE