Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UTF8 problem
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2008
Miscellaneous
Thread ID:
01515496
Message ID:
01515755
Views:
118
You probably shouldn't use ASCII, but System.Text.Encoding.Default which is the default ANSI code page for your system. That way you get the same output you would get in VFP.

The default for textWriters is UTF-8 and as I pointed out if you're reading in those files with FILETOSTR() you can actually read the UTF-8 text directly or else read in the entire text raw and then use STRCONV() on the UTF-8 text.

+++ Rick ---

>Hi rick,
>
>we changead this code in visual studio and now all seems in order...
>
>
>Ceci  : StreamWriter sw = File.CreateText(Application.StartupPath + "\\" + aNumMut + ".txt");   crée un fichier en utf8 incompatible
>  
>remplacé par cela :  StreamWriter sw = new StreamWriter(Application.StartupPath + "\\" + aNumMut + ".txt",false, System.Text.Encoding.ASCII); 
>
>
>
>bernhart
>
>
>>What are you doing exactly to get the UTF-8 string back?
>>
>>As Eric pointed out STRCONV() can be used to convert back and forth, but if you're interacting with .NET (or COM in general) you should only get Unicode back which should auto-convert to your current FoxPro code page.
>>
>>One other thing that's useful is that VFP 9 allows STRTOFILE to import UTF-8 files and strip the BOM and auto-convert from UTF-8. Look at the eFlags parameter.
>>
>>+++ Rick ---
>>
>>
>>>hi all,
>>>
>>>when I pass a string between the visual studio and the visual foxpro the string is modified !
>>>The characters “é” become “é”.
>>>the problem turn around UTF8 but what can i do ?
>>>
>>>thank in advance for help
>>>
>>>bernhart
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform