Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

German Umlauts and DOM


Reply


6 Posts   1642 Views

Avatar
tmkp

Community Member, 42 Posts

2 March 2011 at 12:01am

Hi,

I'm currently setting up a website for a german client and I'm about 90% done.

While creating a page type that holds Dataobjects inside a regular DOM i realized that DOM doesn't seem to handle German Umlauts and special characters (Ä ä Ü ü Ö ö ß) in text fields correctly.

I''m running 2.4.5 and the latest DOM (r540). When entering a string containing Umlauts in a textfield, DOM chops off the string at the position of the first Umlaut upon hitting "save".

The problem does not occur if i switch from Dataobjectmanager to a ComplexTableField, also i don't have any problems with the Umlauts in any other part of system

I'm also reproducing this issue on a 2.4.4 / r540 test setup on a different server, although here the string is not getting chopped off, but Umlauts are being replaced with cryptic symbols (e.g. ö => ö) in the text field

Does anybody have a quick solution for this?

Many thanks in advance,

Andi

Avatar
tmkp

Community Member, 42 Posts

2 March 2011 at 6:38am

Edited: 02/03/2011 10:28am

Update:

I tested this on a localhost / XAMPP installation and the issue does not occur.

Also, while browsing through the databases of both setups i found that all the tables that silverstripe creates are of the collation "latin1_swedish_ci". Shouldn't this be utf-8? Although I seem to remember having read somewhere that this doesn't matter as long as the content of the tables is utf-8.

Anyway, it all works fine on the localhost (even with the latin1_swedish_ci collation), but not on the live server.

What weirds me out too is that it works perfectly well when using a ComplexTableField instead of DOM.

I'm totally stuck for now. Help would be greatly appreciated..

Andi

---------------

Update 2:
I just realized that within the DOM Popup, also the translated Buttons that contain Umlaute show these cryptic Symbols.

So the "Previous" Button for showing the previous Dataobject reads "«Zurück" instead of "Zurück"

No idea.. By the way, Uncle Cheese if you're reading this, the german language file in the current DOM Archive is named deDe3.php (or something like that) instead of de_DE.php and doesn't work if you don't rename it manually. This has in fact been the case for a long time.

Avatar
tmkp

Community Member, 42 Posts

4 March 2011 at 10:31am

Edited: 04/03/2011 10:32am

Playing around with this some more on the live server, and I'm getting even more confused.

First of all, the issue with the german localization. I came across [url=http://www.silverstripe.org/dataobjectmanager-module-forum/show/7010?start=280#post297248]this post[/url] by s!m in the bug reports thread, where he provides german lang files for DOM, Uploadify and ImageGallery with all the Umlauts replaced with their XML counterparts (e.g. ä for ä and so forth).

However, all the other german lang files (systemwide) don't have the Umlauts translated into XML, they're just in there as they come, and, like stated above, everything's working fine for me except for the DOM popups.

I tried changing the the encoding of DOM's de_DE.php to ANSI (just for giggles) and all over sudden the Umlauts in the popups were showing up correctly, BUT the DOM-related Umlauts in the Main CMS tab (like the "Dataobject hinzufügen / Add new Dataobject" Button of the DOM) appeared as question marks.

I also set up a new test install of silverstripe on the same server, this time making sure that the database and all tables were utf8_general_ci (turned out that the SYSCP on the webhost creates new databases as latin1_swedish_ci by default), but still no luck with DOM.

Also, i have a DOM popup with nothing but a SiteTree in a SimpleTreeDropdownField, and even the Page Titles in there get the funny symbols for Umlauts, although they are definitely okay in the database.

No idea.. Any german Silverstripers around here that can confirm these issues?

Or, could this be somehow related to hosting/server issues? I had some trouble with php ownerships when initially setting up silverstripe on this host, but now these all seem to be fixed and the system is running smoothly.

All the best, and thanks again Uncle Cheese for all your effort with this great module.

Avatar
jarop

Community Member, 19 Posts

9 March 2011 at 8:38pm

> No idea.. Any german Silverstripers around here that can confirm these issues?

Yes i can confirm some trouble with the german umlauts

But in my case on the live server it is wokring fine, but the problems ar on the localhost xampp system.

Avatar
tmkp

Community Member, 42 Posts

11 March 2011 at 2:17am

Edited: 11/03/2011 2:48am

Hi jarop

can you provide a more detailed description of the issues you're having?

I'm still trying to figure this out..

Just installed another fresh Silverstripe 2.4.5 with blackcandy theme and the latest DOM (from GitHub) on a testbed, made sure that all the db tables are utf8_general_ci and created a very basic DOM Page like so:

<?php

class BookmarkPage extends Page {

   static $has_many = array (
      'Bookmarks' => 'Bookmark',
   );

   function getCMSFields() {
      $f = parent::getCMSFields();

      // add bookmark manager
      $manager = new DataObjectManager(
         $this,
         'Bookmarks',
         'Bookmark',
         array(
            'Title' => 'Titel',
            'URL' => 'URL',
            'Description' => 'Mouse-Over Text',
         ),
         'getCMSFields_forPopup'
      );

      $f->addFieldToTab("Root.Content.Links",$manager);

      return $f;
   }

}

class BookmarkPage_Controller extends Page_Controller {

}

and

<?php
class Bookmark extends DataObject {

   static $db = array (
      'Title' => 'Text',
      'URL' => 'Text',
      'Description' => 'Text'
   );

   public static $has_one = array (
      "BookmarkPage" => "BookmarkPage",
   );

   public function getCMSFields_forPopup() {
      return new FieldSet(
         new TextField("Title", "Titel"),
         new TextField("URL", "URL (Wichtig: inklusive http:// am Anfang!)"),
         new TextField("Description", "Mouse-Over Text")
      );
   }

}

Here's what's happening.

1. When i add a new Dataobject containing Umlauts, everything seems to be working okay. I hit save, I close the Popup, the Dataobject shows up in the list all right, and also in the frontend

2. When i reopen the same dataobject to edit, the Umlauts show up garbled in the input fields (replaced with the funny öÖäÜ symbols described above). If I leave everything as it is and hit "Save", the Dataobjects again appear normally in the list and frontend.

(All throughout this process, the Umlauts are being stored in the Database correctly as öÖüÜÄäß, just like anywhere else in the system.)

3. If i reopen any existing Dataobject, add some Umlauts and hit "Save", the string will be chopped off at the first occurrence of an Umlaut (also in the database)

This was tested on Firefox 3.6, Opera 11 and IE 8. I did have to add

Requirements::set_combined_files_enabled(false);

to my _config.php to get the cms to load in any other browser than firefox, everything else is running on default settings, fresh install.

Makes me want to pull my hair out : )

UncleCheese, please help!

Many thanks

P.S. If it's helpful, I will gladly provide a link and login credentials to the system to anybody who wants to take a look at this.

------------

EDIT: Again, the issue does not occur when switching from DOM to ComplexTableField

Avatar
hu

Community Member, 21 Posts

7 June 2012 at 3:58am

Hi tmkp,

i had the same problem with a german provider (www.checkdomain.de)
can you switch codepage to utf8 in php configuration menu?