Emill
October 9th, 2008, 09:07 PM
Hello. I have some problems with Vala. I want to read a file and store it in a string that is not utf-8 encoded, because it is some binary data and the substring-function thinks it is an utf-8-encoded string...
http://live.gnome.org/Vala/Tutorial#head-f2b5a7a55957645fb83905eea9660f9293bd1a70
It's that code I use:
string filename = "file";
string content;
ulong len;
FileUtils.get_contents (filename, out content, out len);
Is there any way to tell it it's not an utf-8-string? I also have some problems that if it contains a null-character, it cuts the string at that point if I do this:
string content2 = content;
content2 will be the shorter string.
http://live.gnome.org/Vala/Tutorial#head-f2b5a7a55957645fb83905eea9660f9293bd1a70
It's that code I use:
string filename = "file";
string content;
ulong len;
FileUtils.get_contents (filename, out content, out len);
Is there any way to tell it it's not an utf-8-string? I also have some problems that if it contains a null-character, it cuts the string at that point if I do this:
string content2 = content;
content2 will be the shorter string.