MrKim Well-Known Member Licensed User Longtime User Sep 24, 2013 #1 It would be really nice to have, like File.Readstring but with no interpretation. Just read the binary in to a string variable.
It would be really nice to have, like File.Readstring but with no interpretation. Just read the binary in to a string variable.
Erel B4X founder Staff member Licensed User Longtime User Sep 25, 2013 #2 A string variable cannot hold binary data. You can read a binary file to an array of bytes.
MrKim Well-Known Member Licensed User Longtime User Sep 25, 2013 #3 Erel said: A string variable cannot hold binary data. You can read a binary file to an array of bytes. Click to expand... Perhaps I am using the wrong term? I would like to use some of the ASCII high bit characters. For testing I cut and pasted them in to code as a string, and set a string variable = to them, then used that variable successfully. File.ReadString and File.GetText Would not read the same text from a file into a variable. Below works just fine in code But I cannot read this in from a file: Code: Copy Dim Ftxt AsString Ftxt="001ö®ËTest Fnameö®ËEmployeeLnameö®Ë0ö®Ë0ö®Ë¹Ùé1ö®ËFrankö®ËArmanö®Ë0ö®Ë0ö®Ë¹Ùé100ö®ËLewö®ËHicksö®Ë-1ö®Ë25ö®Ë¹Ùé110ö®ËKimö®ËMosherö®Ë-1ö®Ë35ö®Ë¹Ùé120ö®ËJerryö®ËJonesö®Ë0ö®Ë33ö®Ë¹Ùé128ö®ËANTHONYö®ËEGFEö®Ë0ö®Ë34.31ö®Ë¹Ùé129ö®ËKELLYö®ËIMRMZIö®Ë0ö®Ë26.99ö®Ë¹Ùé130ö®ËJohnö®ËSmithö®Ë0ö®Ë22ö®Ë¹Ùé131ö®ËGARYö®ËARNIPAö®Ë0ö®Ë58.09ö®Ë¹Ùé142ö®ËJIMö®ËEMLEö®Ë-1ö®Ë46.11ö®Ë¹Ùé" I notice I was able to post this correctly as well, even though it contains high bit ASCII.
Erel said: A string variable cannot hold binary data. You can read a binary file to an array of bytes. Click to expand... Perhaps I am using the wrong term? I would like to use some of the ASCII high bit characters. For testing I cut and pasted them in to code as a string, and set a string variable = to them, then used that variable successfully. File.ReadString and File.GetText Would not read the same text from a file into a variable. Below works just fine in code But I cannot read this in from a file: Code: Copy Dim Ftxt AsString Ftxt="001ö®ËTest Fnameö®ËEmployeeLnameö®Ë0ö®Ë0ö®Ë¹Ùé1ö®ËFrankö®ËArmanö®Ë0ö®Ë0ö®Ë¹Ùé100ö®ËLewö®ËHicksö®Ë-1ö®Ë25ö®Ë¹Ùé110ö®ËKimö®ËMosherö®Ë-1ö®Ë35ö®Ë¹Ùé120ö®ËJerryö®ËJonesö®Ë0ö®Ë33ö®Ë¹Ùé128ö®ËANTHONYö®ËEGFEö®Ë0ö®Ë34.31ö®Ë¹Ùé129ö®ËKELLYö®ËIMRMZIö®Ë0ö®Ë26.99ö®Ë¹Ùé130ö®ËJohnö®ËSmithö®Ë0ö®Ë22ö®Ë¹Ùé131ö®ËGARYö®ËARNIPAö®Ë0ö®Ë58.09ö®Ë¹Ùé142ö®ËJIMö®ËEMLEö®Ë-1ö®Ë46.11ö®Ë¹Ùé" I notice I was able to post this correctly as well, even though it contains high bit ASCII.
Erel B4X founder Staff member Licensed User Longtime User Sep 25, 2013 #4 Please create a text file with the text you want to read and upload it to this thread as an attachment.
Please create a text file with the text you want to read and upload it to this thread as an attachment.
MrKim Well-Known Member Licensed User Longtime User Sep 25, 2013 #5 Here is the file as requested. Erel thanks for your continued help. You are truly amazing. Bye the Bye. Just ran across TextReader. Will that do the trick? Attachments PartsAndTimeHighBit.txt PartsAndTimeHighBit.txt 172.7 KB · Views: 344
Here is the file as requested. Erel thanks for your continued help. You are truly amazing. Bye the Bye. Just ran across TextReader. Will that do the trick?
Erel B4X founder Staff member Licensed User Longtime User Sep 25, 2013 #6 When working with text files you must know which encoding is used. My guess is that it is ISO-8859-1: Code: Copy Dim In As InputStream = File.OpenInput(File.DirAssets, "PartsAndTimeHighBit.txt") Dim tr As TextReader tr.Initialize2(In, "ISO-8859-1") Log(tr.ReadAll) In.Close
When working with text files you must know which encoding is used. My guess is that it is ISO-8859-1: Code: Copy Dim In As InputStream = File.OpenInput(File.DirAssets, "PartsAndTimeHighBit.txt") Dim tr As TextReader tr.Initialize2(In, "ISO-8859-1") Log(tr.ReadAll) In.Close
MrKim Well-Known Member Licensed User Longtime User Sep 26, 2013 #7 The encoding is whatever windows/VBA uses. I am writing the files myself in Access VBA using standard text and chr for the high bit stuff. I will give it a try, thanks. As an interesting side note, I originally typed the chr with the (X) and when I tried to post I got an internal server error.
The encoding is whatever windows/VBA uses. I am writing the files myself in Access VBA using standard text and chr for the high bit stuff. I will give it a try, thanks. As an interesting side note, I originally typed the chr with the (X) and when I tried to post I got an internal server error.