rFactor results file errors

CordellCahill

Recently we had someone join our league who has the character 'ä' in their name, and all of a sudden our results files started acting screwy. After further inspection we realized that it was the result xml that rFactor spits out. In UTF-8 encoding, which is what the rFactor XML claims to be, the 'ä' should be stored as the following two-octet sequence: 0xc3a4. Instead, it is stored as 0xbe84.
 
Last edited:
Yeah.. known issue from beginning of rF. Reported but never fixed.

The same problem occurs for chat data. National letters are stored into XML result files using original character set taken from operating system (for example cp1250 for Central European). It make XML screwed since XMLs are utf8.
 
Hi Cordel,

when u open such a XML file in your browser u receive an error message too pointing to the line where the mistake occurs. Although the first line in your rFactor result file "<?xml version="1.0" encoding="utf-8"?>" tells your "parser" it should handle characters UTF-8 style, the actual encoding or physical encoding of the rFactor result file is ANSI !!!

1. Make a backup of your result file
2. Open the result file with NOTEPAD
3. Go to menu: File | Save as...
4. Change "Encoding: ANSI" to "Encoding: UTF-8"
5. Save the file

With that procedure the "logical" and "physical" encoding is now aligned and your parser should not give you any warnings or error. This is my little workaround for the problem MaXyM stated. It might happens that the name of the driver is displayed with a "wrong character" but so far the only workaround for this is to implement a regulation which forces a driver to use only these characters for their driver name: "A-Z", "a-z", " " if you don't want to correct all the "wrong" characters by hand.

Cheers
Frank
 
It is not always true.
If you have users with Central European operating systems, ANSI (cp1252) is not the correct encoding. It should be cp1250.
But when using cp1250 as XML encoding, XML parser also may end up with error if there are ANSI characters in the file (ie in talent names or car names).

SO.. only way is to write some filtering method (removing characters or so) to allow parsing. Specially if you need to make it parsed automatically.
 
We're uploading our results files to our web site, and to overcome this issue, I had to resort to substituting "utf-8" with "iso-8859-1" and convert the bad two-byte characters to the correct single byte characters before parsing the document with an XML parser. The problem isn't just driver names, the entire chat stream is even more likely to contain foreign characters. Let's hope ISI gets this right in rFactor 2.
 
Just tell people not to talk. Problem solved. Hahaha.. Just kidding. This has created problems for me too. I have to filter the characters as I find them. Pain in the butt.
 
We dont allow special caracters in names and then we occasionaly get chat-issues. we upload the results files to the website as well and its then a simple case of deleting all chat from a race and its good to go.
Seem to happen in the more longer races usualy. we have sprint and feature races (short and long) and its usualy the feature race that needs to be tweaked.
 
We're uploading our results files to our web site, and to overcome this issue, I had to resort to substituting "utf-8" with "iso-8859-1" and convert the bad two-byte characters to the correct single byte characters before parsing the document with an XML parser. The problem isn't just driver names, the entire chat stream is even more likely to contain foreign characters. Let's hope ISI gets this right in rFactor 2.

Hi Jorgen, how exactly did you guys do that? I'm having the same problem and would like to convert the incorrect two byte characters into correct ones.

Thanks,
Stevo
 
Hi Stevo,

The snippet below is part of the PHP page that receives the file data, and the function looks like this: (Note: This is only for swedish characters, replace with whatever your need is)

Code:
    //--------------------------------------------------
    // nlsfix()
    //--------------------------------------------------
    function nlsfix($data) {
        // Ugly but effective...
        $nlstext = str_replace("utf-8", "iso-8859-1", $data);
        $nlstext = str_replace("¾†", "å", $nlstext);
        $nlstext = str_replace("¾„", "ä", $nlstext);
        $nlstext = str_replace("¾”", "ö", $nlstext);
        return $nlstext;
    }
 
Hi Jorgen

thanks, I got something similar, which seems to work fine for all 1252 characters , but I was hoping for something generic to solve this once and forever... well maybe rFactor2 :)
 

Back
Top