Codepage, hb_Translate(), OEM <-> ANSI

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

i know HB_ANSITOOEM() or HB_OEMTOANSI()
now i try
HB_TRANSLATE ( <cSrcText>, [<cPageFrom>], [<cPageTo>] )
--> cDstText /* is used usually to convert between the Dos and the Windows code pages of the same language */
so i want to "convert" from "DE850" to "DEWIN"

Code: Select all

   IF aStruc[ i ] [ DBS_TYPE ] = "C" .OR. aStruc[ i ] [ DBS_TYPE ] = "M"
      FIELDPUT( i, hb_Translate( aData[ i ], SourceCP, cCodepage ) )
   ELSE
      FIELDPUT( i, aData[ i ] )
   ENDIF
but it seems not to work ...
when have "GRÜN" it will be "vut off" to "GR"

what i´m doing wrong :?:
need help
CDP_DE.ZIP
Source, NOT complet
(714 Bytes) Downloaded 109 times
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

i got this Source which show possible Codepage
listcdp.zip
(422 Bytes) Downloaded 137 times
but there are much more than show in HMG Help File :?:

---

to use Codepage i need to include

Code: Select all

REQUEST HB_CODEPAGE_xxx
it seems me that not all xxx exist ... or what do i miss understood ... :(
need some help please :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

i have try to get Codepage Information together but can not identify all

p,ease have a look at Source FUNCTION Get_cdpSelect()
Get_CDP.zip
(1.75 KiB) Downloaded 117 times
i try ti "fill" 4th. Element
which Element is need to set Codepage for DBF

---

i need to include

Code: Select all

   REQUEST HB_CODEPAGE_xxx
where do i found it :?:

---

not sure what to display in Listbox (or other) to identify right Codepage
please help to fill Array with right Codepage, thx
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

Convert.EXE

This App can identify many Type of DBF and convert Codepage
These Type are available
"Bulgarian ", "866 " "BG866 "
"Bulgarian ", "ISO-8859-5 " "BGISO "
"Bulgarian ", "MIK " "BGMIK "
"Bulgarian ", "Windows-1251" "BGWIN "
"Croatian ", "437 " "HR437 "
"Croatian ", "852 " "HR852 "
"Croatian ", "Windows-1250" "HRWIN "
"Czech ", "852 " "CS852 "
"Czech ", "ISO-8859-2 " "CSISO "
"Czech ", "KAM " "CSKAM "
"Czech ", "Windoes-1250" "CSWIN "
"English ", "437 " "EN "
"French ", "850 " "FR850 "
"German OEM ", "850 " "DE850 "
"German ANSI ", "ISO-8859-1 " "DEWIN "
"Greek ", "737 " "EL737 "
"Greek ", "Windows-1253" "ELWIN "
"Hungarian (ntxhu852) ", "852 " "HU852C"
"Hungarian (sixhu852) ", "852 " "HU852 "
"Hungarian (ntxhu852) ", "ISO-8859-2 " "HUCWI "
"Hungarian (sixhu852) ", "ISO-8859-2 " "HUISO "
"Hungarian (ntxhu852) ", "Windows-1250" "HUWIN "
"Hungarian (sixhu852) ", "Windows-1250" " "
"Italian ", "437 " "IT437 "
"Italian ", "850 " "IT850 "
"Italian ", "ISO-8859-1b " "ITISB "
"Italian ", "ISO-8859-1 " "ITISO "
"Lithuanian ", "Windows-1257" "LTWIN "
"Polish ", "852 " "PL852 "
"Polish ", "ISO-8859-2 " "PLISO "
"Polish ", "Mazowia " "PLMAZ "
"Polish ", "Windows-1250" "PLWIN "
"Portuguese ", "850 " "PT850 "
"Portuguese ", "ISO-8859-1 " "PTISO "
"Russian ", "866 " "RU866 "
"Russian ", "KOI-8 " "RUKOI8"
"Russian ", "Windows-1251" "RU1251"
"Serbian ", "Windows-1251" "SRWIN "
"Slovak ", "852 " "SK852 "
"Slovak ", "ISO-8859-2 " "SKISO "
"Slovak ", "Kamenicky " "SKKAM "
"Slovak ", "Windows-1250" "SKWIN "
"Slovenian ", "437 " "SL437 "
"Slovenian ", "852 " "SL852 "
"Slovenian ", "ISO-8859-2 " "SLISO "
"Slovenian ", "Windows-1250" "SLWIN "
"Spanish ", "850 " "ES850 "
"Spanish ", "ISO-8859-1 " "ESWIN "
"Spanish Modern ", "ISO-8859-1 " "ESMWIN"
"Swedish ", "850 " "SV850 "
"Swedish (Clipper) ", "437 " "SV437C"
"Swedish ", "ISO-8859-1 " "SVWIN "
"Turkish ", "857 " "TR857 "
"Turkish ", "Windows-1254" "TRWIN "
"Ukrainian ", "866 " "UA866 "
"Ukrainian ", "KOI-8U " "UAKOI8"
"Ukrainian ", "Windows-1251" "UA1251"
"UTF-8 ", "UTF8 " "UTF8 "
CONVERT.zip
EXE only
(1.7 MiB) Downloaded 127 times
how to :

press Get Source DBF
Step1.jpg
Step1.jpg (13.6 KiB) Viewed 3821 times
you will ask for FIELD you want ( default ALL )
Step2.jpg
Step2.jpg (25.67 KiB) Viewed 3821 times
next is Codepage from Source DBF
Step3.jpg
Step3.jpg (50.2 KiB) Viewed 3821 times
now Target DBF Path, Name and CodePage is need
Step4.jpg
Step4.jpg (16.39 KiB) Viewed 3821 times
press GO and a Progressbar will show Action
Step5.jpg
Step5.jpg (33.2 KiB) Viewed 3821 times
Exit App and test if conversation have work

Jimmy
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

i have found LIB hbcpage.a and can read in C:\hmg.3.4.4\HARBOUR\include\hbcpage.hbx
all HB_CODEPAGE_* which are include in HMG Constribution.

as there are "more" than i got before i have to figure out what difference is e.g.

Code: Select all

HB_CODEPAGE_UTF8
HB_CODEPAGE_UTF8EX
HB_CODEPAGE_UTF16LE
and how to REQUEST to use these Codepage :idea:

now i have this for HMG

Code: Select all

REQUEST HB_CODEPAGE_ESWIN
REQUEST HB_CODEPAGE_BGWIN
REQUEST HB_CODEPAGE_DEWIN
REQUEST HB_CODEPAGE_ELWIN
REQUEST HB_CODEPAGE_HUWIN
REQUEST HB_CODEPAGE_PLWIN
REQUEST HB_CODEPAGE_PT850
REQUEST HB_CODEPAGE_RU1251
REQUEST HB_CODEPAGE_SRWIN
REQUEST HB_CODEPAGE_SLWIN
REQUEST HB_CODEPAGE_UTF8EX
are there "more" :?:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

i have REQUEST all HB_CODEPAGE_* from hbcpage.hbx and it does compile / link without Error :)

what Codepage is "DK865" ... it seems not to be "Danisch" as that is "DA"

Code: Select all

*           Locale       Language code  LCID string  LCID decimal  LCID hex  Codepage
   (aLCID,{"Danish    ","da"            ,"da"	   ," 1030"	," 406"	   ,"1252" }
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by andyglezl »

AUGE_OHR wrote: Mon Sep 20, 2021 7:57 am Convert.EXE

This App can identify many Type of DBF and convert Codepage
.................................
Jimmy


:?: :?
Hola Jimmy
Siempre me dice que ya existe el archivo... y no existe...
*-----------------------------------------------------------------------------------------
:?: :?
Hi Jimmy
It always tells me that the file already exists ... and it doesn't exist ...





imagen_2021-09-26_153813.png
imagen_2021-09-26_153813.png (182.3 KiB) Viewed 3611 times
..
..

Ya vi porque:
Se debe añadir al final del path “\” cuando lo exportas…
Porque queda en el directorio superior.
*-----------------------------------------------------------------------------------
I already saw why:
It must be added to the end of the path "\" when you export it ...
Because it remains in the upper directory.
imagen_2021-09-26_161500.png
imagen_2021-09-26_161500.png (104.85 KiB) Viewed 3604 times


.
.
.
.
Muchas gracias Jimmy !!!
*-----------------------------------
Thank you very much Jimmy !!!
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

Thx for Error Message.

i have to "check" for "\" in that Demo App.

---

Source will be Part of HBFM v2.x when have "convert" to MiniGUI Extended Version.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by AUGE_OHR »

hi,

it seems GetFolder() does not include last "\" so i change Code to

Code: Select all

   cDir := GetFolder( cTitle, TRIM( cInitPath ),, lNewFolderButton )
   IF !EMPTY( cDir )
      ExportDbf.Text_Path.value := cDir + "\"  // add "\"
   ENDIF
here some Code to "check" it

Code: Select all

   // per Referenz
   CheckBackSlash(@cText_Path)

PROCEDURE CheckBackSlash(cText_Path)
LOCAL nPosi, nLen := LEN(cText_Path)

   nPosi := RAT( "\", cText_Path )
   IF nPosi <> nLen
      cText_Path += "\"
   ENDIF
RETURN
have fun
Jimmy
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Codepage, hb_Translate(), OEM <-> ANSI

Post by danielmaximiliano »

Gracias x compartir Jimmy
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply