Go Back

unicode encoding

I need to create a text file with a Russian/Greek character set included in it.

This is food food labelling to meet EU standards

I was able to paste the following text into notepad.  When I went to save it is said it couldn't be saved in ASCII format, but could be saved in Unicode format.
I did this and was able to use Bartender to pick up the text and print it correctly.

Golden Sultanas 100g e|Sultanas d’or - Gouden Sultana's - Gyldne Sultanas - Sultana dorata - |Золотой Султанас - Złote Sułtanki - Gylne sultanaer - Gyllene Sultanas|187Kj/44Kcal|0.1g

I need to be able to create this file from a synergy.net application and write the foreign character set text string to it.
Or I could write a C# class and included it in my synergy./net solution

Or maybe there is another way I haven;t thought of?

Any done any multi-lingual food labelling in bartender, using text files created by a synergy application ?


3 Answers
0   | Posted by Gordon Ireland to Synergy .NET on 11/3/2020 5:09 PM
Steve Ives
Am I missing something here, or is this what you are looking for?
import System.IO
import System.Text

    ;Read a UTF-8 file into a string
    data text = File.ReadAllText("D:\UTF8InputFile.txt",Encoding.Utf8)

    ;;Write a string with UTF-8 data to a UTF-8 file
    File.WriteAllText("D:\UTF8OutputFile.txt", text, Encoding.UTF8)


11/12/2020 6:02 PM   0  
Steve Ives
By the way, UTF8InputFile.txt is just a file containing the data from your example, saved with UTF8 encoding. The UTF8 data is successfully loaded from the file into a string and successfully saved out to another UTF8 encoded file. A diff shows the files to be identical.

11/12/2020 6:06 PM   0  
Gordon Ireland
Thanks Steve.  That is exactly what I was looking for.


11/12/2020 7:23 PM   1  
Please log in to comment or answer this question.