Namespace: OpenEdge.Net
Class
PercentEncoder
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object

Copyright (c) 2022 by Progress Software Corporation. All rights reserved.
File:PercentEncoder
Purpose:Percent-encodes and -decodes character data
Author(s):pjudge
Created:2022-01-10
Notes:* Values outside of the ASCII range are always encoded
/* An array of flags indicating which ASCII chars to encode or not. Characters to encode must have a value of TRUE




Method Summary
Options Name Purpose
LONGCHAR Decode (character) /** Attempts to decode a previously percent-encoded string. @param longchar The string to decode @return longchar A decoded URL @throws AppError If the encoding is malformed */
LONGCHAR Decode (character, character) /** Attempts to decode a previously percent-encoded string. @param longchar The string to decode @param character The target codepage to encode into. Defaults to UTF-8 @return longchar A decoded string. This is longchar since it may contain non-ASCII or Unicode characters. @throws AppError If the encoding is malformed */
CHARACTER Encode (longchar) /* Encodes a string per the input flags. Characters in the ASCII range (0-127) are encoded per the flags passed in; all other characters are always %-encoded. @param longchar The string to encode. This is longchar since it can handle unicode data even when the session can't. We do not expect this to contain GB's of data. @param logical[128] An array of flags indicating which ASCII chars to encode or not. Characters to encode must have a value of TRUE @return character The encoded string. Return value is character since the "bad" characters have been encoded. */
CHARACTER Encode (longchar, logical) /* Encodes a string per the input flags. Characters in the ASCII range (0-127) are encoded per the flags passed in; all other characters are always %-encoded. @param longchar The string to encode. This is longchar since it can handle unicode data even when the session can't. We do not expect this to contain GB's of data. @param logical TRUE if existing % values must be reencoded as %25 @return character The encoded string. Return value is character since the "bad" characters have been encoded. */

Constructor Summary
Options Name Purpose
PercentEncoder (logical[128]) /* Constructor. @param logical[128] An array of flags corresponding to the ASCII character set */

Property Summary
Options Name Purpose
LOGICAL EncodingFlags


Method Detail
Top

LONGCHAR Decode (character)

Purpose: Attempts to decode a previously percent-encoded string.
@throws AppError If the encoding is malformed
Parameters:
pEncodedString CHARACTER
Returns LONGCHAR
longchar A decoded URL
Top

LONGCHAR Decode (character, character)

Purpose: Attempts to decode a previously percent-encoded string.
@throws AppError If the encoding is malformed
Parameters:
pEncodedString CHARACTER
pTargetCodepage CHARACTER
Returns LONGCHAR
longchar A decoded string. This is longchar since it may contain non-ASCII or Unicode characters.
Top

CHARACTER Encode (longchar)

/* Encodes a string per the input flags. Characters in the ASCII range (0-127) are
encoded per the flags passed in; all other characters are always %-encoded.
We do not expect this to contain GB's of data.
a value of TRUE
Parameters:
pString LONGCHAR
Returns CHARACTER
character The encoded string. Return value is character since the "bad" characters have been encoded.
Top

CHARACTER Encode (longchar, logical)

/* Encodes a string per the input flags. Characters in the ASCII range (0-127) are
encoded per the flags passed in; all other characters are always %-encoded.
We do not expect this to contain GB's of data.
Parameters:
pString LONGCHAR
pReencode LOGICAL
Returns CHARACTER
character The encoded string. Return value is character since the "bad" characters have been encoded.


Constructor Detail
Top

PercentEncoder (logical[128])

/* Constructor.
Parameters:
pFlags LOGICAL


Property Detail
Top

LOGICAL EncodingFlags

Returns LOGICAL


Copyright © 2022 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 12.6.0