Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-BETA3
    • Fix Version/s: 1.2.0-RC1
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      W2003 Server
      MSSQL 2000 (Collation: Latin1_General_CI_AS)
      PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
      Copyright (c) 1997-2007 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

      Description

      I'm testing doctrine 1.2.0-B3 connected to mssql 2000 for XML based exports.

      We use latin1 (ISO-8859-1) as collation for the mssql server. When i now create an XML export in Doctrine, Doctrine uses SimpleXML which requires the strings encoded in UTF-8, but our mssql collation is latin1. This results in a invalid, non UTF-8 XML file.
      It's required to add the ability to convert the strings from the database encoding to the 'export' encoding.
      (similar to http://trac.doctrine-project.org/ticket/1887)

      I have added a simple patch to add this possibility, then we can do something like this:

      Doctrine_Parser::dump($data->toArray(false, true), 'xml', 'testExport.xml', 'ISO-8859-1');
      
      1. parser_encoding_parser.diff
        0.6 kB
        Benno Eggnauer
      2. parser_encoding_xml.diff
        0.6 kB
        Benno Eggnauer

        Activity

        Hide
        Benno Eggnauer added a comment -

        Because arrayToXml is a recursive method, add the encoding parameter to the recursive method call.

        81c81
        <                 self::arrayToXml($value, $rootNodeName, $node, $charset);
        ---
        >                 self::arrayToXml($value, $rootNodeName, $node);
        

        I think the use of htmlentities is not recommended, because the method doesn't create XML compliant strings.

        If you want to use the function, use it with encoding.

        $value = htmlentities($value, ENT_COMPAT, 'UTF-8');
        OR
        $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
        
        Show
        Benno Eggnauer added a comment - Because arrayToXml is a recursive method, add the encoding parameter to the recursive method call. 81c81 < self::arrayToXml($value, $rootNodeName, $node, $charset); --- > self::arrayToXml($value, $rootNodeName, $node); I think the use of htmlentities is not recommended, because the method doesn't create XML compliant strings. If you want to use the function, use it with encoding. $value = htmlentities($value, ENT_COMPAT, 'UTF-8'); OR $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
        Hide
        Jonathan H. Wage added a comment -

        Thanks for letting me know I missed that

        Show
        Jonathan H. Wage added a comment - Thanks for letting me know I missed that

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Benno Eggnauer
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: