FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Are xHarbour and Excel UTF8 working?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 02:46 AM

Dear All,

I would like to import data from Excel and some charactor is UTF8 (Myanmar), but it shows and ???? (asterisk).

Thanks in advance,

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 04:02 AM

Dear Dutch,

Please post an example to review how you are doing it, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 06:11 AM
Dear Antonio,
Antonio Linares wrote: Dear Dutch,

Please post an example to review how you are doing it, thanks
#include 'FiveWin.ch'

Static aData

Function Main
local oRange, oError

cFileName := 'd:\jv.xlsx' 
	TRY 
	   oRange := GetExcelRange( cFileName )  
	   aData  := ArrTranspose( oRange:Value )
	   oRange:WorkSheet:Parent:Close()
	CATCH oError 
		MsgStop( 'Unable to Open thie file.', oError:Description )
	END

XBROWSER aData

return nil
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 02:03 PM
Try this,
// C:\FWH\SAMPLES\DUTCH3.PRG

#include 'FiveWin.ch'

// Enter your country codes: TIS 620-2533
EXTERNAL HB_LANG_TIS, HB_CODEPAGE_PTISO, HB_CODEPAGE_874 //( Thailand? )

#ifNdef __XHARBOUR__     // Somente para HARBOUR, XHARBOUR nao tem isso ainda.
   REQUEST HB_CODEPAGE_UTF8
   REQUEST HB_CODEPAGE_UTF8EX
#endif

STATIC aData

FUNCTION Main()

   LOCAL oRange, oError, cFileName

   // Enter your country codes: TIS 620-2533
   #ifdef __XHARBOUR__

      HB_LANGSELECT( 'PT' )
      HB_SETCODEPAGE( "PT850" )
      HB_CDPSELECT( "PTISO" )
      HB_SETCODEPAGE( "UTF8" )

   #Else // HARBOUR

      HB_LANGSELECT( 'PT' )
      HB_SETCODEPAGE( "UTF8" )
      HB_CDPSELECT( "UTF8EX" )
      HB_SETCODEPAGE( "PT850" )
      HB_CDPSELECT( "PTISO" )

   #Endif

   cFileName := 'd:\jv.xlsx'

   IF FILE( cFileName )

      TRY

         oRange := GetExcelRange( cFileName )
         aData  := ArrTranspose( oRange:Value )

         oRange:WorkSheet:Parent:Close()

      CATCH oError

         MsgStop( 'Unable to Open thie file.', oError:Description )

      END

      XBROWSER aData

   ELSE

      ? "No file found in D:\"

   ENDIF

RETURN NIL

// FIN / END
Regars, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 04:32 PM
Dear Karinha,

I try to compile but it shows error.
Error: Unresolved external '_HB_FUN_HB_LANG_TIS' referenced from D:\FWH2304\SAMPLES\XLSTEST3.OBJ
Error: Unresolved external '_HB_FUN_HB_CODEPAGE_874' referenced from D:\FWH2304\SAMPLES\XLSTEST3.OBJ
karinha wrote: Try this,
// C:\FWH\SAMPLES\DUTCH3.PRG

#include 'FiveWin.ch'

// Enter your country codes: TIS 620-2533
EXTERNAL HB_LANG_TIS, HB_CODEPAGE_PTISO, HB_CODEPAGE_874 //( Thailand? )

#ifNdef __XHARBOUR__     // Somente para HARBOUR, XHARBOUR nao tem isso ainda.
   REQUEST HB_CODEPAGE_UTF8
   REQUEST HB_CODEPAGE_UTF8EX
#endif

STATIC aData

FUNCTION Main()

   LOCAL oRange, oError, cFileName

   // Enter your country codes: TIS 620-2533
   #ifdef __XHARBOUR__

      HB_LANGSELECT( 'PT' )
      HB_SETCODEPAGE( "PT850" )
      HB_CDPSELECT( "PTISO" )
      HB_SETCODEPAGE( "UTF8" )

   #Else // HARBOUR

      HB_LANGSELECT( 'PT' )
      HB_SETCODEPAGE( "UTF8" )
      HB_CDPSELECT( "UTF8EX" )
      HB_SETCODEPAGE( "PT850" )
      HB_CDPSELECT( "PTISO" )

   #Endif

   cFileName := 'd:\jv.xlsx'

   IF FILE( cFileName )

      TRY

         oRange := GetExcelRange( cFileName )
         aData  := ArrTranspose( oRange:Value )

         oRange:WorkSheet:Parent:Close()

      CATCH oError

         MsgStop( 'Unable to Open thie file.', oError:Description )

      END

      XBROWSER aData

   ELSE

      ? "No file found in D:\"

   ENDIF

RETURN NIL

// FIN / END
Regars, saludos.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 05:16 PM
Dutch, sorry, I don't know the page codes for your country. Please, if you know, modify the example for your country, ok?

Dutch, lo siento, no conozco los códigos de página de tu país. Si los conoces, por favor, adapta el ejemplo a tu país, ¿de acuerdo?

Look,

https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers

Gracias, tks.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Mon Jul 07, 2025 05:31 PM
Dutch, now it's complicated, it seems to me that there is no hb_cdpSelect() for Thailand.

Dutch, ahora es complicado, me parece que no hay hb_cdpSelect() para Tailandia.

https://vivaclipper.wordpress.com/2014/01/16/hb_cdpselect/

It's better to wait for the FiveTech team.

Mejor esperar al equipo de FiveTech.

Sorry, regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Tue Jul 08, 2025 02:20 AM

Dear Karinha,

Thanks for your kind help.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: Are xHarbour and Excel UTF8 working?

Posted: Fri Jul 11, 2025 02:20 AM

Dear Antonio,

I try as ChatGPT recommend by combile C++ code but not success. It's still unreadable.

Any recommendation.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion