FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour Working with dbf
Posts: 179
Joined: Fri Dec 07, 2007 01:26 PM
Working with dbf
Posted: Tue Jul 27, 2021 07:50 AM
Dear friends,
our landingpage example works with dbfs.
Please can you help me: What is the difference between "Codifica ANSI" and "Codifica OEM".


i have to use a lot of special characters and therefor have a function
Code (fw): Select all Collapse
function convertUmlaute( cVData )
    local ctest := ""
    local I := 0

// ´ 
cVData  :=  STRTRAN(cVData, chr(180), "´" )

// Ä
cVData  :=  STRTRAN(cVData, chr(196), "Ä"   )
 
// Ö
cVData  :=  STRTRAN(cVData, chr(214), "Ö"   )
 
// Ü
cVData  :=  STRTRAN(cVData, chr(220), "Ü" )
 
// ß
cVData  :=  STRTRAN(cVData, chr(223), "ß" )
 
// à 
cVData  :=  STRTRAN(cVData, chr(224), "à" )
 
// á
cVData  :=  STRTRAN(cVData, chr(225), "á" )

// ä
cVData  :=  STRTRAN(cVData, chr(228), "ä"   ) 

// ö
cVData  :=  STRTRAN(cVData, chr(246), "ö"   )
 
// ü
cVData  :=  STRTRAN(cVData, chr(252), "ü"   )
    
return(cVData)

that is called for example from here:
Code (fw): Select all Collapse
use ( cTMPPage ) new ALIAS landingpage
logging( "close: " + cTMPPage   )
Close 
use ( cTMPPage ) new ALIAS landingpage

index on field->ID  TAG TmpB5Nr TO TEMP5 TEMPORARY
do while .not. eof()
  if field->ready = .T.
   if field->LANGUAGE  = cPage
      nRecords += 1
      AADD( aRelationship_DBF, ( "REC" + "_" + ALLTRIM( STR( nRecords ) ) + "_"  )  )

     if VALTYPE( field->ID ) = "N"
        hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID )  
     
     elseif VALTYPE( field->ID ) = "D"
         hHash_DBF[ "REC" + "_" + ALLTRIM( STR(nRecords ) ) +"_ID" ] = dtoc( field->ID )  
      
      elseif VALTYPE( field->ID ) = "C"  .or. VALTYPE( field->ID ) = "M" 
         if LEN( ALLTRIM( field->ID ) ) = 0
            hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID ) 
         else
            hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( CONVERTUMLAUTE (  field->ID  ) )
         endif
      else   
         hHash_DBF[ "REC" + "_" + ALLTRIM( STR( nRecords ) ) +"_ID" ] = ALLTRIM( field->ID )
      endif

but if I input a special character in "Codifica OEM" mode it is not showing correctly on my site...



http://winhotel.space/lp/bergland_sillian/landingpage3.prg?sprache=it

would it be better to work with "codifica ANSI" in general?

thank you a lot and kind regards
ruth
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Working with dbf
Posted: Tue Jul 27, 2021 08:18 AM

OEM is for the older MS-DOS text.

EMG

Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Working with dbf
Posted: Tue Jul 27, 2021 12:26 PM

Ruth,

Your dbf will be encoded in ansi and not in utf8. I recommend that you code on your page if you use dbf as follows

<meta charset = "ISO-8859-1">

If you have the data in the dbf in utf8, you can use the encoding of your page with utf8

<meta charset = "utf-8">

You should be aware of 3 situations if you use dbfs with harbour. As you have your encoded table. As you have encoded your code. and as you encode your web page

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 179
Joined: Fri Dec 07, 2007 01:26 PM
Re: Working with dbf
Posted: Thu Jul 29, 2021 07:45 AM

thank you two very much. this did the trick...now everything is showing fine when I put it manually on the dbfs. now we are building a backend for the user and i will post again :-) kind regards to all of you and have a nice day
ruth

Continue the discussion