Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Visual Basic CHRW function in VFP
Message
De
23/09/2009 21:02:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/09/2009 20:40:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01425853
Message ID:
01425854
Vues:
62
>Hi all, I'm doing a program that needs to handle chr function for numbers higher than 255 in example chr(9450) it works perfectly in VB with chrw(9450), any ideas?
>
>T.I.A

I understand that dotnet has built-in support for Unicode; Visual FoxPro does not. chr(x) just returns a single byte, strings are usually stored one byte per character. This makes any work with Unicode quite complicated, i.e., there is no built-in support. Some double-byte encodings are supported in Visual FoxPro; but I believe Unicode is not explicitly supported.

Do some reading on double-byte encoding (or something similar, not quite sure about the terminology) in Visual FoxPro; but in my opinion, if you need to work with non-latin characters, that would be one reason to switch to a more modern language, like Java or dotnet.

Mind me, I like Visual FoxPro very much, and I am sad that no new versions will be published; however, I see that it does have some serious limitations, some of the major ones being the lack of future versions; the lack of support for Unicode; and the lack of support for non-Windows platform.

Unicode was originally designed as a single standard for multilingual character sets, with the idea of replacing the multitude of standards in existence. It was also originally designed as a double-byte character set, that is, with a capacity for 65,000 characters. Modern Unicode, however, defines over a million (!) different characters and symbols, and uses different encoding schemes, some of them of variable length: common characters may use a single byte, less common characters up to 4 bytes.

Read the Wikipedia article, or other references, for a more detailed (and probably more accurate) description. The point is, it seems to indeed have become a standard, being used as a standard, for string data, in several modern programming language, including Java and C#. Not sure about VB.NET, but it is probably the same there.

Back to Visual FoxPro: If you figure out how the character is stored, you may be able to convert your number (for example) to a double-byte character, by calculating the components (the individual bytes) and using chr() on each one. But you will probably be in deep trouble if you try to use standard Visual FoxPro string-handling with that - that would be more for import and export.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform