The online racing simulator
MPR file text encoding
(8 posts, started )
MPR file text encoding
I try to capture info from multiplayer replay file. I tried "utf-8", "ascii",, "cp1251", "cp1252", "cp1253" encodings. Currently "cp1252" works best. But I get this: "12 - R.Kronpu^Bðs" instead of "12 - R.Kronpušs"

(bytes are: 12 - R.Kronpu^B\xf0s\x00\x00\x00\x00\x00\x00\x00)
(49 50 32 45 32 82 46 75 114 111 110 112 117 94 66 240 115 0 0 0 0 0 0 0)

Do I need to interpret ^B as some special character? Or do I need to use some other encoding?
Proud to make problems with my last name!

Well,I had similar problems with driver profile loading when switching to new laptop (copy/paste LFS folder),as they were encoded differently... Just commenting,no idea for solutions here,as encoding is a foreign language for me.
LFS uses CP-1252 encoding by default, but there are special control sequences such as ^B which tell LFS that the following part of a string is in a different encoding. If you speak C#, you might want to take a look at how InSim.NET handles this (http://insimdotnet.codeplex.co ... nSimDotNet/LfsEncoding.cs).
@MadCatX: Thanks for information! That should solve my problem. I contact you if find problems reading the code (I think C++ knowledge should be enough to understand C#). Very helpful

@Eclipsed: I encountered this when tried to develop simple championship points counting program. Here is current result (I have no replays from last stage):
private static $codepages = array(
'L' => 'CP1252', // Latin 1
'G' => 'CP1253', // Greek
'C' => 'CP1251', // Cyrillic
'E' => 'CP1250', // Central Europe
'T' => 'CP1254', // Turkish
'B' => 'CP1257', // Baltic
'J' => 'CP932', // Japanese
'S' => 'CP936', // Simplified Chinese
'K' => 'CP949', // Korean
'H' => 'CP950' // Traditional Chinese
);

These are the code page conversions that you are looking for as per Vic. So after you see a Caret and then one of these characters you have to use the corresponding code page from then on in the string. But if you see ^8 or ^9 you have to convert back to the default code page (IIRC, but ^8 might only apply to color, and ^9 applies to everything).
Thanks Dygear for even more references. For now it works good. In replay file (at least in header) I didn't meet ^8 or ^9 characters (as far as I remember) so if I see ^* I covert 1 letter and then revert back to cp1252.

Maybe in further replay parsing (now I need to find out what players was on starting grid, because they do not get to header if they do not finish).
Quote from vitaly_m :I try to capture info from multiplayer replay file. I tried "utf-8", "ascii",, "cp1251", "cp1252", "cp1253" encodings. Currently "cp1252" works best. But I get this: "12 - R.Kronpu^Bðs" instead of "12 - R.Kronpušs"

(bytes are: 12 - R.Kronpu^B\xf0s\x00\x00\x00\x00\x00\x00\x00)
(49 50 32 45 32 82 46 75 114 111 110 112 117 94 66 240 115 0 0 0 0 0 0 0)

Do I need to interpret ^B as some special character? Or do I need to use some other encoding?

LFS uses escape codes to switch codepages because it does not use UTF8 and has it's own messy playername/message/... encoding.
Colors are fine that's pretty standard but the codepages are certainly not.

Quote from vitaly_m :Thanks Dygear for even more references. For now it works good. In replay file (at least in header) I didn't meet ^8 or ^9 characters (as far as I remember) so if I see ^* I covert 1 letter and then revert back to cp1252.

Maybe in further replay parsing (now I need to find out what players was on starting grid, because they do not get to header if they do not finish).

I would rather say the switch is applied until you encounter another switch that resets the current code page while reading that string or sets a new. Not only 1 character but a whole sequence.

Vitaly: best get a library that converts/handles these custom LFS strings. Reads/writes and strips/converts them.

LFS devs: please use UTF8 or something else that is standardized and supported widely. Even old and simple C has wide chars.
Quote from JackCY :I would rather say the switch is applied until you encounter another switch that resets the current code page while reading that string or sets a new. Not only 1 character but a whole sequence.

That is correct. The 'switch' applies until another 'switch' is seen.

MPR file text encoding
(8 posts, started )
FGED GREDG RDFGDR GSFDG