# German Umlaute with Lazarus

**URL:** https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041
**Category:** Data Abstract
**Created:** [April 15, 2015, 3:03pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041 "2015-04-15T15:03:40Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [April 15, 2015, 3:03pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/1 "2015-04-15T15:03:40Z")

</div>

Hi  
I build the same App as with Delphi and in Lazarus there are no German Umlaute  
( like äöü ), there are replaced with a ?.  
If i access the Database form Delphi it looks normal.

Did anybody have the same Problem?

Manfred

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [April 15, 2015, 3:53pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/2 "2015-04-15T15:53:31Z")

</div>

Are you using AnsiString or WideString fields? Essentially, whenever you’re using 8-byte strings, using any characters over #127 is a gamble, and depends on what codepage your database and your app are on — which might or might work, but when it does, it should be considered an accident ;).

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [April 16, 2015, 1:45pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/3 "2015-04-16T13:45:25Z")

</div>

Hi mh

> Are you using AnsiString or WideString fields?

I am using WideString fields.  
My connectin string is:

> [mysql.net](http://MySql.NET?Server=localhost;Database=gdbsync_test;User) ID=ga\_test;Password=secret; convert zero datetime=True;

With the Schema Modeler the Data look also ok.  
I did also ad CharSet=utf8; to the connection string with no change.

The Connection String in the App looks like:

> RelativityConnectionString: String = ‘User Id=“data\_user”;Password=“secret”;Domain=“TEST”;Schema=“admin”;CharSet=utf8;’;

PS: The Password and the Schema Data are fake 😉

Shalom  
Manfred

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [April 16, 2015, 2:30pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/4 "2015-04-16T14:30:45Z")

</div>

Hm, so this is a .NET server (or Relativity?) with a Delphi vs FPC client? If the fields are set up as WideString, that this sounds like something the DA/Delphi team needs to look at, client side. I’ll make sure this gets to the right person and someone gets back to you asap.

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [April 16, 2015, 2:40pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/5 "2015-04-16T14:40:21Z")

</div>

I use a Relativity Server with Lazarus as a Client.  
Delphi works.  
Thanks

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [April 17, 2015, 12:15pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/6 "2015-04-17T12:15:45Z")

</div>

this is problem in fpc itself.  
this simple testcase will fail:

```auto
program a;
{$MODE DELPHI}
uses
  SysUtils, DB, memds;
var
  mem: TMemDataset;
  str, fld: WideString;
  s: string;
begin
  str := widechar(#$00E4) + widechar(#$00F6) + widechar(#$00FC); // 'äöü';
  mem := TMemDataset.Create(nil);
  try
    mem.FieldDefs.Add('fld1', ftWideString, 20);
    mem.Open;
    mem.Insert;
    mem.fields[0].asWideString := str;
    mem.post;
    fld := mem.fields[0].AsWideString;
    if fld <> str then s := 'test is failed' else s := 'test is passed';
    writeln(s);
  finally
    mem.Free;
  end;
end.

```

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [April 17, 2015, 1:11pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/7 "2015-04-17T13:11:10Z")

</div>

Hi  
Thank you for your Replay…  
Will look forward how i can solve this.

Have a nice Weekend.  
Shalom  
Manfred

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [July 14, 2015, 2:20pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/8 "2015-07-14T14:20:39Z")

</div>

Hi again

found out that with this Code ( under Lazarus 1.4 ) i can convert the Umlaute into a correct value:

```
procedure Tfrm_hotel.idChange(Sender: TObject);
var
  test_string :String;
begin
    test_string:= AnsiToUTF8(DM_hotel.tbl_hotel.FieldByName('NAME').AsString);
end;    

```

Of course i could to this on every Edit field… but this seems a little unproductive… 😌  
Hope there is a way to do this in a central place…

Thank’s for any advice.

Shalom  
Manfred

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [July 15, 2015, 6:23am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/9 "2015-07-15T06:23:22Z")

</div>

You can create a shared function like

```auto
function GetStringValue(aTable: TDADataTable; aFieldName: String):String;
begin
  result := AnsiToUTF8(aTable.FieldByName(aFieldName).AsString);
end;

procedure Tfrm_hotel.idChange(Sender: TObject);
var
  test_string :String;
begin
    test_string:= GetStringValue(DM_hotel.tbl_hotel,'NAME');
end;

```

it won’t solve current problem, but will allow to update code only in one place (GetStringValue) when proper solution will be found.

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 18, 2015, 7:57am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/10 "2015-09-18T07:57:39Z")

</div>

Hi again

Did quite some “research” on this Topic.  
It lookls like the Combination of Lazarus + RemObjekts do a 2times UTF8 covertion.  
One time to much.  
Since when i generate Data in the Lazarus App:

> Test öäü éàèç

Lazarus can read this Data as:

> Test öäü éàèç

But in the Database the Entry is:

> Test Ã¶Ã¤Ã¼ Ã©Ã\*Ã¨Ã§

When there are Data already in the Database Lazarus and RemObjet read it not correct, since the Data are in the correct way in the Database. ( Not inserted by Lazarus )  
These Data can be read with Delphi and RemObjects correctly.

I did also get some Feedback from a Lazarus Developer who is Developing a Database Tool that Lazarus itself has no Problem with UT8. ( It was the Developer of IBExpert [http://www.ibexpert.net/ibe/index.php?n=Main.IBExpert](http://www.ibexpert.net/ibe/index.php?n=Main.IBExpert)

I realy like RemObject and it would be great if this could be solved. 😊

In the Delphiprais ( a German speaking Forum ) i also started a Post to get help for this “Lazarus” Problem. [http://www.delphipraxis.net/186609-umlaute-lazarus-1-4-2-mit-datenbank-2.html#post1316122](http://www.delphipraxis.net/186609-umlaute-lazarus-1-4-2-mit-datenbank-2.html#post1316122)

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 22, 2015, 9:00am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/11 "2015-09-22T09:00:59Z")

</div>

Hi again

Did some additional research.  
I setup zeos and testet my MySQL Database with a normal TDBGrid and it works.  
The Umlaute are there.( Please see the Attached Picture )  
IMHO Lazarus has no Problem with Special Characters. ( Like öäü èàé )

It would be Great if this Problem could be solved.

Thank you in advance  
Manfred

 ![](https://talk.remobjects.com/uploads/default/original/2X/a/a0a9ca2745ea290e3154d410fd0504b744451471.JPG)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [September 22, 2015, 9:24am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/12 "2015-09-22T09:24:23Z")

</div>

I’ve tried to compile [my testcase](http://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/6) (from this topic) with FPC 3.1.1 and it is still failed:(

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 22, 2015, 12:09pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/13 "2015-09-22T12:09:17Z")

</div>

Hi EvgenyK

Thank you for your Replay.  
I use Lazarus 1.4.2 stable with FPC 2.6.4 the normal official Version from the Website.  
[http://www.lazarus-ide.org/](http://www.lazarus-ide.org/)

I can compile your code and get the result: test is passed 😉

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 22, 2015, 2:51pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/14 "2015-09-22T14:51:04Z")

</div>

Crosspost: [Crosspost: Cannot compile Application in Delphi XE4 and Lazarus](http://talk.remobjects.com/t/crosspost-connot-compile-delphi-xe4-and-lazarus/6904)

Hi again just found out that there is a new Version of RemObjects SDK for Delphi - 8.3.93.1183.exe since Mon, Sep 21, 2015.  
With this Version there is a general Problem.  
I did post that already here:  
[http://talk.remobjects.com/t/dataabstract-beta-thu-sep-3-2015-with-lazarus-problems/6820](http://talk.remobjects.com/t/dataabstract-beta-thu-sep-3-2015-with-lazarus-problems/6820)

So with the newest Version i cannot compile at all…  
With the Version RemObjects Data Abstract for Delphi - 8.3.91.1167 it was fine. 😉

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [September 22, 2015, 11:16pm UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/15 "2015-09-22T23:16:02Z")

</div>

> [@Manfred](#):
>
> I can compile your code and get the result: test is passed

what switches you are used? I’ve tried  
{$mode delphiunicode}  
{$ModeSwitch UnicodeStrings}  
{$codepage utf8}  
and it still fails

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 23, 2015, 6:55am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/16 "2015-09-23T06:55:25Z")

</div>

Good Morning EvgenyK

I did use no switches at all.  
Just a plain empty Project and copy & paste your code.  
I attached the sample Project for you. If i can help you please let me know.

Shalom  
Manfred[test.zip](https://talk.remobjects.com/uploads/default/original/2X/d/d2447f43a264ba3748d031342f5f64fec836a590.zip) (1.7 KB)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [September 23, 2015, 7:35am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/17 "2015-09-23T07:35:45Z")

</div>

hmm, it still doesn’t work for me.  
tested with

```auto
lazarus-1.4.2-fpc-2.6.4-win64.exe 2015-07-12 114.2 MB 	

```

[test\_exe.zip](https://talk.remobjects.com/uploads/default/original/2X/f/f2cec129ca32f23db33cb42ff11e6132ba77816c.zip) (178.6 KB)

I’ve added

```auto
  Write ('This program was compiled at ',{$I %TIME%});
  Writeln (' on ',{$I %DATE%});
  Writeln ('Compiler version: ',{$I %FPCVERSION%});
  Writeln ('Target CPU: ',{$I %FPCTARGET%});
  writeln ('');

```

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 23, 2015, 7:45am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/18 "2015-09-23T07:45:33Z")

</div>

It does compile here:

```
program test;
{$MODE DELPHI}
uses
  SysUtils, DB, memds;
var
  mem: TMemDataset;
  str, fld: WideString;
  s: string;
begin
  str := widechar(#$00E4) + widechar(#$00F6) + widechar(#$00FC); // 'äöü';
  mem := TMemDataset.Create(nil);
  try
    mem.FieldDefs.Add('fld1', ftWideString, 20);
    mem.Open;
    mem.Insert;
    mem.fields[0].asWideString := str;
    mem.post;
    fld := mem.fields[0].AsWideString;
    if fld <> str then s := 'test is failed' else s := 'test is passed';
    Write ('This program was compiled at ',{$I %TIME%});
    Writeln (' on ',{$I %DATE%});
    Writeln ('Compiler version: ',{$I %FPCVERSION%});
    Writeln ('Target CPU: ',{$I %FPCTARGET%});
    writeln ('');
    writeln(s);
  finally
    mem.Free;
  end;
end.  

```

 ![](https://talk.remobjects.com/uploads/default/original/2X/1/1b87211777760446653f932eda6d47957694cbe3.JPG)  
 ![](https://talk.remobjects.com/uploads/default/original/2X/1/1509f45a186d057dd84a07dec9e95e4e79a9bdf0.JPG)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [September 23, 2015, 8:36am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/19 "2015-09-23T08:36:41Z")

</div>

I’ve the same version of Lazarus.  
Probably it depends on current language for non-Unicode programs so it isn’t correct unicode support.  
try to change it with locale that doesn’t support German Umlaute and retest.

 ![](https://talk.remobjects.com/uploads/default/original/2X/e/edebc38a2c031fea55d7550fc6be1829af99f681.png)

---

<div class="post-metadata">

### Author: ![Manfred](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/0ea827/32.png) [@Manfred](https://talk.remobjects.com/u/Manfred)
#### Post date: [September 23, 2015, 9:23am UTC](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041/20 "2015-09-23T09:23:12Z")

</div>

Did try it with english ( Britan ) language for non-Unicode programs. and it worked…

 ![](https://talk.remobjects.com/uploads/default/original/2X/1/1aa0355e000dd073cdb789d40cb7ff1226a46041.JPG)

[Next page](https://talk.remobjects.com/t/german-umlaute-with-lazarus/6041.md?page=2)
