Namespace: Consultingwerk.Util
Class 
CodepageHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

Purpose: Verifies if a given CHARACTER or LONGCHAR value complies with a
target code page
Notes: Tries to assign the value to a LONGCHAR fixed to the target codepage
and handles error ** Unable to update Field. (142)



Top Method Summary
Options Name Purpose
+ LOGICAL CompliesWithCodepage (ISerializable, character) Verifies if a given ISerializable instance complies with a target code page
+ LOGICAL CompliesWithCodepage (handle, character) Verifies if a given ProDataset or Temp-Table complies with a target code page
+ LOGICAL CompliesWithCodepage (longchar, character) Verifies if a given CHARACTER or LONGCHAR value complies with a target code page
+ LONGCHAR ConvertToCodepage (longchar, character) Converts a string from its codepage into another codepage-encoded string
+ INT64 UnicodeCodepointToUtf8 (int64) Converts a Unicode codepoint into a UTF8 integer value, which can be used by the CHR() statement


Method Detail
Top

PUBLIC LOGICAL CompliesWithCodepage (ISerializable, character)

Purpose: Verifies if a given ISerializable instance complies with a target
code page
Notes: Writes the ISerializable to an UTF-8 LONGCHAR and verifies code page
compliance of that LONGCHAR

Parameters:
poData Consultingwerk.ISerializable
The reference to the ISerializable instance to test
pcTargetCodepage CHARACTER
The target code page to verify against
Returns LOGICAL
Logical value indicating of the value complies with the target codepage
Top

PUBLIC LOGICAL CompliesWithCodepage (handle, character)

Purpose: Verifies if a given ProDataset or Temp-Table complies with a target
code page
Notes: Saves the temp-table as XML to an UTF-8 LONGCHAR and verifies code page
compliance of that LONGCHAR

Parameters:
phData HANDLE
The Handle of the ProDataset or Temp-Table to test
pcTargetCodepage CHARACTER
The target code page to verify against
Returns LOGICAL
Logical value indicating of the value complies with the target codepage
Top

PUBLIC LOGICAL CompliesWithCodepage (longchar, character)

Purpose: Verifies if a given CHARACTER or LONGCHAR value complies with a
target code page
Notes: Tries to assign the value to a LONGCHAR fixed to the target codepage
and handles error ** Unable to update Field. (142)

Parameters:
plcValue LONGCHAR
The LONGCHAR or CHARACTER value to test
pcTargetCodepage CHARACTER
The target code page to verify against
Returns LOGICAL
Logical value indicating of the value complies with the target codepage
Top

PUBLIC LONGCHAR ConvertToCodepage (longchar, character)

Purpose: Converts a string from its codepage into another codepage-encoded string
Notes: Uncovertible characters are ignored/thrown away in the target string and
so this method should be used with care.

Parameters:
plcValue LONGCHAR
The input string, that may or not contain uncovertible characters
pcTargetCodepage CHARACTER
The codepage for the converted string
Returns LONGCHAR
The converted string, in the target codepage.
Top

PUBLIC INT64 UnicodeCodepointToUtf8 (int64)

Purpose: Converts a Unicode codepoint into a UTF8 integer value, which can be used by the CHR() statement
Notes: Based on the OpenEdge.Core.Util.UTF8Encoder:UnicodeToUtf8 method.
The UTF8Encoder class is only available since OpenEdge 12.5, so we use this method

Parameters:
piUnicode INT64
The Unicode codepoint
Returns INT64
The UTF-8 integer value. Will be ZERO/0 if the codepoint is unknown or negative.


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 06:16:31