I posted a similar question earlier but deleted it because I was wrong about the problem.
I’m trying to swap this code:
string contents = System.IO.File.ReadAllText("filename", Encoding.Unicode);
With this code (so I can put it on a web player):
TextAsset temp = (TextAsset)Resources.Load("filename", typeof(TextAsset));
string contents = Encoding.Unicode.GetString(temp.bytes);
I’ve also just tried getting the plain string directly using temp.string, but neither one produces the same encoding of the results as my old code did. The text file itself has a lot of weird characters, like NUL, ACK, and Chinese symbols, and I don’t quite understand how the code processes them (I didn’t write it), but I can tell it’s being interpreted wrong because the new code gives me an invalid input error when I try to pass the result to the next method, while the old code works just fine.
Anyone know what is different about those two statements?