hb_Translate()

HB_TRANSLATE()

Translate a string from one code page to the other

Syntax

      HB_TRANSLATE( <cSrcText>, [<cPageFrom>], [<cPageTo>] ) --> cDstText

Arguments

<cSrcText> Is the source string to translate.

<cPageFrom> Is the optional character code page ID of the source string. If not specified, the default code page is used.

<cPageTo> Is the optional character code page ID of the destination string. If not specified, the default code page is used.

Returns

HB_TRANSLATE() return destination string converted from the source string.

Description

HB_TRANSLATE() try to convert a source string from one code page into the other. If a code page ID is not recognized, or not linked in, the default code page is used. HB_TRANSLATE() is used usually to convert between the Dos and the Windows code pages of the same language.

NOTE: If the source code page and target code page does not have the same number of characters, a translation can not be done and the destination string is a copy of the source string.

NOTE: You must REQUEST every code page module you intend to use. For example: to use the Russian RU866 code page you must add the following to your program: REQUEST HB_CODEPAGE_RU866

Examples

      REQUEST HB_CODEPAGE_DE
      REQUEST HB_CODEPAGE_DEWIN
      PROCEDURE Main()
         LOCAL cTxt := "A" + Chr( 142 ) + "BC"
         ? "German CP-850 text:", cTxt
         ? "German Windows-1252 text:", hb_Translate( cTxt, "DE", "DEWIN" )
         RETURN

Compliance

This function is a Harbour Extension.

Platforms

All

Files

Libraty are rtl, codepage

Seealso

HB_LANGSELECT(), HB_CDPSELECT(), NATIONMSG(), REQUEST

Advertisements

3 responses to “hb_Translate()

  1. Pingback: Harbour All Functions – H | Viva Clipper !

  2. Pingback: Harbour Language and Nation Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s