XML Fehler nach Update von 1.7.1 auf 1.8.1


(hpa) #1

Nach dem Update generiert Piwik Fehlermeldungen (vermutlich bei Umlauten) vor dem eigentlichen XML Content:
[size=small]Warning: htmlspecialchars() [function.htmlspecialchars]:
Invalid multibyte sequence in argument in /var/www/html/piwik/core/DataTable/Renderer.php on line 223[/size]

Der XML Content selbst wird nach den (evtl. vielen) Fehlermeldungen anschließend ohne Fehler dargestellt.

Kann man dies umgehen bzw. abstellen?


#2

Dear developers,

first of all thanks for all your energy and work you put into this tool!

Unfortunately we face the same issue, and it might be special characters like Chinese, Russian, or Japanese signs we saw as entry in Piwik’s Action Section. Before the new version we escaped special characters ourselves, and these characters were the vertical tab (vt) and “/>” as entry in the Action Section:

   private void ReplaceSpecialChars(string filepath, long linenumber)
    {
        System.IO.StreamReader strm;
        string strline;
        string strreplace = " ";

       
        
        //locally
        string tempfile = "D:\\Temp.xml";

        try
        {
            System.IO.File.Copy(filepath, tempfile, true);
        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message);
        }

        System.IO.StreamWriter strmwriter = new System.IO.StreamWriter(filepath);
        strmwriter.AutoFlush = true;
        strm = new System.IO.StreamReader(tempfile);
        long i = 0;
        while (i < linenumber - 1)
        {
            strline = strm.ReadLine();
            strmwriter.WriteLine(strline);
            i = i + 1;
        }

        strline = strm.ReadLine();
        Int32 lineposition;

        lineposition = strline.IndexOf((char)11);//replace character (vt), Oct=0013 Hex=0x0b 
        if (lineposition > 0)
        {
            strreplace = "";
        }
        //not sure why we need this either...:
        else
        {
            lineposition = strline.IndexOf("<", 1);
            if (lineposition > 0)
            {
                strreplace = "<";
            }
        }
        strline = strline.Substring(0, lineposition - 1) + strreplace + strline.Substring(lineposition + 1);
        //hack:
        //not sure why we need it here, but it works :-)
        //1_2011_8_getVisitDurationAndBounceRate.xml caused problems. In Piwik, the entry that caused problems was:
        // /> 	1 	1 	0% 	25s 	0% 
        // right behind 
        // motorrad 	2 	1 	0% 	15s 	100% 
        // pdf 	2 	2 	0% 	12s 	0% 
        if (strline.Contains("<label>") == false)
        strline = strline.Replace("<label", "<label>");
        //end hack

        strmwriter.WriteLine(strline);

        strline = strm.ReadToEnd();
        strmwriter.WriteLine(strline);

        strm.Close();
        strm = null;

        strmwriter.Flush();
        strmwriter.Close();
        strmwriter = null;

    }

Help would be highly appreciated !

Greetings from Munich!


#3

Hallo hpa,

schau mal auf 301 Moved Permanently
Dort wird das gleiche Problem besprochen.

Viele Grüße!