Hi Yakano,
> Thanks for the effort you put to help me. I hope not to bore you with my
> insistence, but I'll recap my old application if I'm doing the wrong
> approach.
>
> My old Clipper application, as I said, is in Clipper 5.2e, but does not
> use the codepage cp850, cp437 it is used the whole application (DFB,
> gets, says) and I really do not know why; perhaps we purchased to
> Nantucket an English version updated to 5.2 and Spanish 5.2e, but I'm
> not sure.
I do not see any references to ntxspa.obj or similar in your Clipper
link scripts, so apparently you are using the original English 437
codepage with no modifiers and in straight ASCII collation order?
Here is a CP437 character chart:
http://en.wikipedia.org/wiki/Code_page_437
That page has further links to other relevant character charts for DOS,
Windows etc
> On some machines that load the page 850 (common in Spanish) I had to use
> the "chcp 437" command before calling the application from a file.bat,
> to get the characters onscreen out well, but that does not affect data
> collection or as stored remains cp437.ina
I never used the chcp utility with Clipper, and that worked well for the
characters I use in Swedish. I only had to sacrifice the tick mark
chr(151), and that was never a big deal for me.
> In some cases I use char fields to store binary data (some cases
> encrypted and other cases each bit is used as flag on/off). I hope any
> automatic translation was made beteen code pages when I use ES850C
> instead of EN.
If you use the same codepage for the VM, Set(_SET_CODEPAGE), as for the
saving of data in dbfs, Set(_SET_DBCODEPAGE), there is no automatic
translation. But if for example you set the _SET_CODEPAGE to a WIN or
ISO codepage and the _SET_DBCODEPAGE to a codepage based on 437 or 850,
then you have to take special care with your binary data, or it will be
modified in the automatic translation. I solve that problem by
converting binary data to hexadecimal before saving.
> The problem with the solutions provided is that if I fix one thing,
> spoiling another (maybe I'm a little dizzy). I do not get it to work
> like *my* clipper version (I no longer know if it is normal or a weirdo).
Yes, you have to know what you do before you do it :-). That is why it
is important to study the available codepages and to make sure the
codepages used in your Clipper application and your Harbour application
use *exactly* the same codepages for saving data in dbfs (that is the
Set(_SET_DBCODEPAGE) codepage setting in Harbour). If there is the
slightest mismatch between the two, and both access the same data, there
*is* going to be index corruption sooner or later. Testing box drawing
functions to see how CP437 or Unicode box characters can be used on the
same screen as for example ESWIN text also helps you understand what
Harbour can do.
> In Clipper application *** upper (chr (164)) = 'Ñ' = chr (165) *** even
> using cp437 *** (!). Can anyone confirm that it happens in your old
> version of Clipper? Maybe something changed from 5.2e to 5.3?
That is CP437, as you can see in the Wikipedia page I linked to above.
It has nothing to do with Clipper versions unless you changed nation
module (ntxspa.obj for example) between the the versions.
> In Harbour I can get this with ES850 and ES850C, but ES850C which has
> more similarities with boxes and accented vowels, although others fail
> because it is different from cp437 (attached images).
>
> The codepage that properly interpreted indexes was ES850C (compatible
> ntxspa.obj,
Do you mean that you use ntxspa.obj with Clipper after all?
> I guess also DBFCDX), which maintains order ... MN * Ñ * OP
> ... the other place the * Ñ * Z behind . I tried to concurrently access
> Clipper and Harbour on it dbf, because it can happen temporarily, and
> everything seems fine, by the moment.
Don't try to concurrently access the data, use the cpinfo utility with
Clipper too and compare the output. Sorry, I should have been more clear
about that yesterday. It compiles with Clipper too if you modify the
call to Main(). The output from Clipper is the output that whatever
Harbour codepage you use must match.
> By using cp437 there are characters like the euro, which are not
> available. In that case (using the imagination: P) I used abundantly chr
> (238) = '∈' (epsilon) to fill the gap. I have not checked the entire
> application, but certainly encounter more, for example chr (251) = '√'
> (tap), etc ...
That is where the box functions come into the picture.
> The code page ES850C gives almost no problems with boxes, because most
> single or double use, only a few are mixed and I'm able to change. Also
> as fperillo said, much of the forms are read says memo fields in
> databases, so using HB_DispBox and adapt these forms (over two thousand)
> would be fatal for my health. ;)
Yes, that is why I said yesterday that the quickest solution might be to
stay with the 437 based codepage also on screen, at least for the time
being. If the Clipper application uses no nation module, collation
should be in straight ASCII order, and the default EN codepage in
Harbour should match it. But apparently there is something that does not
match. So run the cpinfo test in Clipper with your usual Clipper setup
and see what result you get.
> With the suffix "C" (for compatibility / clipper) I only found ES850C.
> Can you tell which is the other ES***C or where to find the list?
Sorry, when looking at the directory again with fresher eyes :-) there
is CPES850M, mdxspa.obj compatible, which uses the same system with
numerical arrays for setting up the collation. The "normal" way to build
a codepage, one that does not have to follow Clipper peculiarities, is
to use the Unicode based character list in src\codepage\l_es.h (for
Spanish) (must be viewed with a Unicode enabled editor or it will look
like crap) and just include it in a .c file with some specific settings
to create a new codepage. But you seem to need a CPES437C codepage that
is based on what cpinfo reports when run from Clipper.
> Initially used DBFNTX but before the (then) feared Y2K was changed to
> DBFCDX, but no character translation was made. We simply indexed and if
> databases with memo fields each field is copied to a temporary base,
> erased the initial, temporary was renamed and indexed.
>
> The databases contain always uppercase (0..9 A..Z) and Ñ = chr (164).
> There may also be ç = chr (135) and Ç = chr (128), as incomprehensible
> to Clipper5.2e (at least mine) upper (chr (135)) = 'ç' = chr (135).
Yes, and again that is the character mappings in the Wikipedia page I
linked to.
> I have generated cpinfo.exe (hbmk2 cpinfo.prg) and executed with various
> parameters (code pages). I do not know exactly if this is what I should
> do; please if
> need other information on this utility, detail what I have to do.
Please run it one more time, compiled with Clipper and linked with
whatever nation module you might normally link with your Clipper
application (if any).
> The application is still in console harbour mode. HB_GTI_BOXCP is for
> console or graphical environment? No further changes I think it will
> only get confuse.
It is for integrating box characters from codepage "X" with normal text
from codepage "Y" on the same TUI screen.
> If you need I send some .LNK file or some component of "my" Clipper,
> please tell me which.
>
> I do not know why ES437C is no needed for the rest of Spanish users, but
> I've read that many posts correcting issues with the code. Perhaps
> passing a graphical interface or operating system change, simply change
> the values stored in DBF and pass ESWIN and do not care to maintain full
> compatibility, then start even more important changes that change chr
> (165) = 'Ñ '(ES850c) by chr (209) =' Ñ '(ESWIN). But time is not my
> case, but if I can bring this project to the end, it may be worthwhile
> to take a step more in the future ...
If it was a question about only reading text from files and creating
screens with boxes and such from code, then I would suggest
Set(_SET_CODEPAGE,"ESWIN") and Set(_SET_DBCODEPAGE,"ES437C") when that
dbcodepage exists, but the integrated text and boxes in your memo fields
makes everything more complicated.
But let us start with the Clipper output from cpinfo and take it from there.
Regards,
Klas