I'm not sure if it is possible to use Umlaute in XML Files
or not.  Maybe this post with help you:
http://stackoverflow.com/questions/11772468/reading-xml-files-with-umlaut-chars

Is there a way to change encoding to "iso-8859-1"?


Mike


On 7/28/2016 8:03 AM, beginners-digest-h...@perl.org wrote:






Hi,

I would like to read XML files which look like this:


<?xml version='1.0' ?>
<data id="build_Inventur_1469705446">
  <meta
      http-equiv="content-type" content="text/html; charset=UTF-8">
<instanceID>uuid:ee1bd852-37ee-4965-a097-50130cf6dac7</instanceID>
  </meta>
  <Stationsnummer>Infostand</Stationsnummer>
  <Mitarbeiter_inv>5449000134264</Mitarbeiter_inv>
  <Bezeichnung1/>
<Regaletikett_ausgeben>gro&#223;</Regaletikett_ausgeben>
  <Erfassung>
    <Artikel_erfassen/>
    <Lagerstaette>5449000134264</Lagerstaette>
    <Artikelstapel>
      <EAN_Artikel>5449000134264</EAN_Artikel>
      <Preis>10.0</Preis>
      <Menge>20</Menge>
      <Etikettentyp/>
    </Artikelstapel>
  </Erfassung>
</data>


There is an Umlaut, ß, supposed to be at


<Regaletikett_ausgeben>gro&#223;</Regaletikett_ausgeben>



which is apparently impossible to read.  The following program ...


#!/usr/bin/perl

use strict;
use warnings;

use feature 'say';

use XML::Simple;
use Data::Dumper;


my $xml = new XML::Simple;
my $data = $xml->XMLin("test.xml");

open my $fh, ">", 'pout';
print $fh Dumper($data);
close $fh;

print Dumper($data);


exit 0;


... gives me this output:


$VAR1 = {
          'Bezeichnung1' => {},
          'id' => 'build_Inventur_1469705446',
          'Stationsnummer' => 'Infostand',
          'meta' => {
                    'content' => 'text/html; charset=UTF-8',
                    'http-equiv' => 'content-type',
'instanceID' => 'uuid:ee1bd852-37ee-4965-a097-50130cf6dac7'
                  },
          'Mitarbeiter_inv' => '5449000134264',
          'Regaletikett_ausgeben' => "gro\x{df}",
          'Erfassung' => {
                         'Artikelstapel' => {
                                            'Menge' => '20',
                                            'Preis' => '10.0',
'EAN_Artikel' => '5449000134264',
                                            'Etikettentyp' => {}
                                          },
                         'Artikel_erfassen' => {},
                         'Lagerstaette' => '5449000134264'
                       }
        };


I´m not getting any better results when adding an encoding tag to the
XML file and when writing the Dumper output to a file.

Is it impossible to use Umlaute in XML Files?

Reply via email to