Hello Michel and Michael,
Thank you very much for your replies, they are very much appreciated.
I already looked in the Xojo documentation and did not found anything (I see that GetTextEncoding page too) with which I can work with.
There is also no Byte Order Mark present.
However I experimented a little and I wrote a short piece of code as an example. There is no error checking. The user gets a dialog to select the first file, after which the whole content is read in the string “strValue”. The file closes and its encoding is stored in “encIObit_1”. Then another dialog is presented to choose the second file. Again the content is read, file closed and the encoding for the second file is stored in “encIObit_2”
Then I compare the encodings, which must be the same. In my case I tested with the original IObit language and the file I translated. Both are the same, so everything is fine.
Here is the example code :
[code]Dim f_Bestand As FolderItem
Dim tisBestand As TextInputStream
Dim strValue As String // Just the string used for testing
Dim encIObit_1 As TextEncoding // Encoding string/file 1
Dim encIObit_2 As TextEncoding // Encoding string/file 2
// Choose the first file
f_Bestand = GetOpenFolderItem(fltIOBit.IObitLanguage) // ask for the first file
tisBestand = TextInputStream.Open(f_Bestand)
strValue = tisBestand.ReadAll // Read the whole content of the file in this string
tisBestand.Close
encIObit_1 = strValue.Encoding // Get the encoding of the first file
// Choose second file
f_Bestand = GetOpenFolderItem(fltIOBit.IObitLanguage) // ask for the second file
tisBestand = TextInputStream.Open(f_Bestand)
strValue = tisBestand.ReadAll // Read the whole content of the file in this string
tisBestand.Close
encIObit_2 = strValue.Encoding // Get the encoding of the second file
If encIObit_1 <> encIObit_2 Then
MsgBox(“TextEncoding is different”)
Else
MsgBox(“TextEncoding is the same as it should be”)
End If[/code]
It is obvious that Xojo can compare the IObit original file and my own file. So I think that I can set the correct encoding for the file I created by :
strTranslatedText = DefineEncoding(strValue, encIObit_2)
where :
strTranslatedText = the text I just translated and are going to save
strValue = the original text from the unknown file
Can I ask you, if the checking method I just created is safe?
Thank you very much again for your time spend on my problem. I really do appreciate it because when I get this to work, I will save a lot of time on those language translations. Xojo does perfectly what I want during the translation process, this is only the last step which was holding me back. I will mention you too in the “About…” window.
Wish you both a very nice day and all the best.
Greetings,
Chris