Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

International characters 1

Status
Not open for further replies.

jimstarr

Programmer
Feb 6, 2001
975
0
0
US
I've never worked with code pages before.

I have an application that displays in any one of 8 languages as chosen by the user in a Preferences screen. The translations are done phrase by phrase based on a DBF which contains a column for each language. It work great, except for the fact that it's limited to the standard American character set.

What would I need to do in order to get it to correctly display characters from the alphabet of the chosen language (in this case, Slovenian)? Thanks!!!

Jim
 

Jim,

Do you need to display data that is stored in a table, or is this simply a question of displaying strings in your user interface?

If the former, you need to make sure the tables are marked with the correct code page ID. In this case, I guess the code page would be 1250 (Eastern European Windows), but you'd have to check that.

The table gets its code page when it's created. You can use CPDBF() to find what code page a given table has. To change the code page, you cpzero.prg to remove the existing code page, then open the table. You will be prompted for the new code page.

If you are only concerned with displaying text in your user interface, it's probably enough to use CPCONVERT() to convert the string. Note that the conversion is not completely reliable. If the target code page contains characters that are not present in the current font, they will display as empty rectangles or as rubbish characters.

Finally, keep in mind that most Western European languages do not require a change of code page. French, German, Spanish and many others can be represented with the same code page as English. Maybe Slovenian as well - I don't know. I believe Norwegian and possibly Portugese need their own code page.

I hope this puts you on the right track. Come back if anything needs further explanation.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks, Mike.

It's data from a table. It initially comes from a 2-column Excel spreadsheet, 1 column for the English phrase, the other Slovenian. The spreadsheet shows all the correct characters when displayed on the screen via Excel.

I'm playing with the following code to bring the data into FoxPro:

CREATE CURSOR cursor1 CODEPAGE = 1250 (english C(135), slovenian C(135))
APPEND FROM myexcel TYPE XLS AS 1250
BROWSE

The BROWSE loses the special characters.

Jim
 

Jim,

My reading of the Help for the AS clause in APPEND FROM suggests that you should be omitting this clause. The code page of the Excel file is probably Western (even though you can see Slovenian characters in it). The Help suggests that, by omitting the AS clause from APPEND FROM, the text will be converted to the code page of the target table, which is Eastern Europe. This is what you want.

Perhaps you could check the Help and see if you agree with my interpretation.

Also, can you check that Slovenian is indeed Eastern European. That was only an assumption on my part. I've only been to Slovenia once (an eventful visit to Ljubljana), but from what I remember, the alphabet looks very similar to Croatian and Czech -- basically, the Latin alphabet with loads of diacriticals -- so it's probably a safe assumption.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Omitting the AS clause seems to make no difference. Also, using a selection of different code page numbers doesn't do the trick. I've also tried CODEPAGE = 852 in config.fpw with no luck.

Jim
 
if you are using win XP then go to control panel, Regional and Language options, Advanced tab and under "Language for uni-code programs" select Slovenian and finaly restart computer.

Is that OK for you?

Michael Kopljan
 
Thanks, Michael. That works!!!

(It actually says "Language for NON-unicode programs.)

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top