[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: CODEPAGE question

Status
Not open for further replies.
P

Peter Judge

Guest
From the Help, it looks like your assertion is correct. Default character conversions with the ASSIGN statement When the target field is a . . . And the source expression results in a . . . The AVM converts the result of the source expression to . . . CHARACTER LONGCHAR -cpinternal code page LONGCHAR CHARACTER -cpinternal or the fixed code page > BTW, I you look at the OpenEdge.Core.String new type, you will see it actually encapsulates a LONGCHAR variable and exposes an Encoding property, probably to use the FIX-CODEPAGE() Statement. Sebastien, is there something that's not working properly? Or not in an expected way? The OpenEdge.Core.String object - holds all its values in a (private) UTF-8-encoded longchar (regardless of the session's CPINTERNAL value) - has an Encoding property that defaults to CPINTERNAL - Has a public Value property that's a longchar and which performs a CODEPAGE-CONVERT() when needed (when the GET runs). /** Contains the actual string value. Marked as NON-SERIALIZABLE since the actual value is derived, and stored in the private mUTF8Value variable */ define public non-serializable property Value as longchar no-undo get (): // no need for changes if we're using UTF-8 as CPINTERNAL if this-object : Encoding eq 'UTF-8' :u then return mUTF8Value. else return codepage-convert (mUTF8Value, this-object : Encoding ). end get . You should be able to see this easily enough. def var objString as OpenEdge.Core.String. def var lcValue as longchar . def var lcIn as longchar . fix-codepage (lcIN) = 'utf-8' . lcIN = ' Ä ' . objString = new OpenEdge.Core.String(lcin). objString: Encoding = 'ISO8859-1' . lcValue = objString: Value . message 'session:cpinternal = ' session : cpinternal skip // is UTF-8 in my case 'lcValue:cpinternal = ' get-codepage (lcValue) // should be ISO8859-1 string (lcValue) view-as alert-box .

Continue reading...
 
Status
Not open for further replies.
Top