wapi_GetOEMCP()

Harbour, MingW related news.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 3797
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 78 times
Been thanked: 126 times

wapi_GetOEMCP()

Post by Pablo César » Wed Mar 01, 2017 1:45 am

Hi all,

I found an important function (at least for me it is). :P
(attention to Dr. Claudio, I've not it seen in HMG or even at extended and probably very useful)

This function return the current OEM code page.

Recently I had a big problem, in this application, with the identification of the current code page, because the error messages in the output of HBMK2 are recorded in OEM and I could not fix it with CP as Portuguese and also due the application is used in several other languages.

For how want to test it:

Code: Select all

* Copyright 2012 Viktor Szakats
#include "hbextcdp.ch"

MsgDebug( __CPWinToCPStd( wapi_GetOEMCP() ) )

STATIC FUNCTION __CPWinToCPStd( nCPWin )
SWITCH nCPWin
   CASE 65001 ; Return "utf8"
   CASE 1200  ; Return "utf16"
   CASE 437
   CASE 737
   CASE 775
   CASE 850
   CASE 852
   CASE 855
   CASE 856
   CASE 857
   CASE 858
   CASE 860
   CASE 861
   CASE 862
   CASE 863
   CASE 864
   CASE 865
   CASE 866
   CASE 869
   CASE 874
   CASE 1250
   CASE 1251
   CASE 1252
   CASE 1253
   CASE 1254
   CASE 1255
   CASE 1256
   CASE 1257
   CASE 1258  ; Return "cp" + hb_ntos( nCPWin )
   CASE 28591
   CASE 28592
   CASE 28593
   CASE 28594
   CASE 28595
   CASE 28596
   CASE 28597
   CASE 28598
   CASE 28599
   CASE 28603
   CASE 28605 ; Return "iso8859-" + hb_ntos( nCPWin - 28590 )
   CASE 20866 ; Return "koi-8"
   CASE 21866 ; Return "koi-8u"
   CASE 936   ; Return "GBK"
   CASE 950   ; Return "CP950"
ENDSWITCH
Return Nil
 
Lovely, doesn't it ? :P
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
srvet_claudio
Posts: 1864
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 25 times
Been thanked: 68 times
Contact:

Re: wapi_GetOEMCP()

Post by srvet_claudio » Wed Mar 01, 2017 3:59 am

Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Pablo César
Posts: 3797
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 78 times
Been thanked: 126 times

wapi_GetOEMCP()

Post by Pablo César » Wed Mar 01, 2017 4:12 am

Thank Claudio for your info. I've seen those MSDN guides.

Yes but I am talking about in Harbour. Not in C I'm talking.

Anyway, it has not even used in C neither at both Minigui versions...

Just for Your Guidance ;)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest