HMG controls and ANSI / UTF8 strings

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

HMG controls and ANSI / UTF8 strings

Post by esgici »

Hi

Code: Select all

frmRectText.ebxText.Value := cInpText      
MsgDebug(  HMG_IsUTF8( cInpText ), HMG_IsUTF8(frmRectText.ebxText.Value ) ) // .F., .T:
It seems HMG controls automatically convert strings ANSI to Unicode :?

If so, this behavior seem is not convenient to me :(

Code: Select all

     IF !HMG_IsUTF8( cInpText ) 
        cInpText :=  HMG_ANSI_TO_UNICODE( cInpText )
     ENDIF
I don't like do frequently this (and converse) in prgs.

My string are not always uniform in format, sometime ANSI, sometime Unicode.

So SETtingCODEPAGE TO <one or auther> is not convenient for me. Because of this, working with IDE ANSI too don't solves my problem :(

Does may be a possibility that HMG controls treats strings as-is basis; if ANSI, ANSI, if Unicode, Unicode :?: :? (like modern text editors)

TIA
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG controls and ANSI / UTF8 strings

Post by srvet_claudio »

See in source/debugger/dbgGUI.prg the function Load PRG.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG controls and ANSI / UTF8 strings

Post by esgici »

srvet_claudio wrote:See in source/debugger/dbgGUI.prg the function Load PRG.
If you are about this (line 1335-1339)

Code: Select all

      IF HMG_IsCurrentCodePageUnicode() == .T. .AND. HMG_IsUTF8( aLineCode [i] ) == .F.
         aLineCode [i] := HMG_ANSI_TO_UNICODE( aLineCode [i], NIL )
      ELSEIF HMG_IsCurrentCodePageUnicode() == .F. .AND. HMG_IsUTF8( aLineCode [i] ) == .T.
         aLineCode [i] := hb_UTF8ToStr( aLineCode [i], NIL )
      ENDIF
I couldn't explain my problem right; I don't want to repeat this code snap in every string operation.

I hope HMG controls can do this (again, like modern text editors).

Anyway thank to interest.

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG controls and ANSI / UTF8 strings

Post by srvet_claudio »

Introduce an internal function in each control that automatically convert an ANSI string to Unicode is possible but this change the standard behavior of Windows APIs.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG controls and ANSI / UTF8 strings

Post by esgici »

srvet_claudio wrote:Introduce an internal function in each control that automatically convert an ANSI string to Unicode is possible but this change the standard behavior of Windows APIs.
OK Dr., thanks :arrow:

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG controls and ANSI / UTF8 strings

Post by esgici »

esgici wrote:...
It seems HMG controls automatically convert strings ANSI to Unicode :? ...
Sorry, this sentence isn't correct :oops:

It should be :
It seems HMG controls automatically pretends ANSI strings as Unicode :?
Of course this occurs when compiling Unicode; ANSI compiling (fe via IDE_ANSI) Unicode strings treads as ANSI :(

If so, this behavior is worse to me :(

I don't want a compiler (or library) don't change my string's format.

Probably this isn't so facile, and is simply my personal approach.

FYI only.

TIA
Viva INTERNATIONAL HMG :D
Post Reply