Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


What happened to the ß?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-20-2008, 10:06 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default What happened to the ß?

I have a text file, x, containing some "ß" characters. When I use k=FileRead (x), k contains no "ß" characters. So if I loop though the file reading lines, and writing them to a second file, the second file will be shorter than the first, rather than identical.

This is a big problem if the file is in German!

What on earth is going on??

Thanks

James
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 10:09 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,900
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

You may have opened the file in ASCII mode rather than Unicode.
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 10:28 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default Ah ha!

Thanks for the quick reply agraham - I guess that must be it!
Reply With Quote
  #4 (permalink)  
Old 04-21-2008, 02:10 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default Problem unresolved

Using FileOpen(x,filename,cRead,,cAscii), when I FileRead(x), the "ß" characters appear as "?" characters. So writing all the lines to a second file results in a file of the same length.

Using FileOpen(x,filename,cRead), the "ß" characters disappear altogether as I described earlier.

This is rather strange
Reply With Quote
  #5 (permalink)  
Old 04-21-2008, 06:53 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,335
Default

FileOpen(x,filename,cRead) should be able to handle these characters.
Can you upload a text file with these characters?
Reply With Quote
  #6 (permalink)  
Old 04-21-2008, 08:10 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 817
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

If the original file was saved with ANSI coding, you cannot read the special characters.
If you read the text file with Notepad and save it back with UTF-8 coding
you will get the special characters in B4PPC.
I have made a test with Notepad, I created a file with special characters in, saved it with ANSI coding, and read this file in B4PPC with FileOpen(c1,"Test.txt",cRead). The special characters don't appear.
Reading back the same file with Notepad and saving it with UTF-8 coding, the special characters appear normaly in B4PPC.
The strange thing is that with Notepad the special characters are normaly displayed whatever the coding is.

Best regards
__________________
Klaus
Switzerland
Reply With Quote
  #7 (permalink)  
Old 04-21-2008, 10:33 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default

Quote:
Originally Posted by Erel View Post
FileOpen(x,filename,cRead) should be able to handle these characters.
Can you upload a text file with these characters?
I created pretty much a random file in Pocket Word to test what was happening, like this:

Aßßß
Bßcßßß
C???ß
de

This is saved as a txt file, saying No to the dialog which asks if I want to save it as word instead. When it is reopened in Pocket Word, it appears unchanged.
Reply With Quote
  #8 (permalink)  
Old 04-21-2008, 10:47 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default Uploaded file

Attached txt file, although it looks different in Notepad on the PC, with "ß" characters changed to "฿"!! I guess this is something to do with pocket word.

A฿฿฿
B฿c฿฿฿
C???฿
dc


Also attached is the beginning of original file where I first noticed the problem.
Attached Files
File Type: txt test.txt (23 Bytes, 7 views)
Reply With Quote
  #9 (permalink)  
Old 04-21-2008, 10:51 AM
Junior Member
 
Join Date: Mar 2008
Location: Thailand
Posts: 45
Default Original file

attached.
Attached Files
File Type: txt origfile.txt (17.9 KB, 10 views)
Reply With Quote
  #10 (permalink)  
Old 04-21-2008, 12:01 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,335
Default

The last file attached was saved encoded with ASCII and not UTF-8.
It doesn't contain any "special" characters.

You can use Notepad to create the file and then choose Save As - Encoding - UTF8.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:19 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0