lcd 20x4: Problem character-shift on lines 2 and 3 [SOLVED]

I just tested a 20x4 lcd display, and it appeared that it works well except a shift of 4 columns on lines 2 and 3 (first line being 0).
It means that if programing
lcd.setCursor(0,2);
lcd.print("hello");
the "hello" word starts with the 'h' letter on row 2 but column 4 instead of column 0 (shifted by 4 characters to the right).
After a look in the library that I downloaded from arduino.cc (LiquidCrystal.cpp) I could find the setCursor() procedure and the following line:
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
I tried to modify this line and replace by:
int row_offsets[] = { 0x00, 0x40, 0x10, 0x50 };
and it works well now.
May be this can help someone else...(?)
In fact I don't know if this comes from an error in this library, or if it works well with devices from other manufacturers and the problem is related to my device.
Sorry for my bad English.
For more information about the exact lcd 20x4 display device I use, a picture of its back side is attached to this post.

I just tested a 20x4 lcd display. . .

Are you sure that your display is 20x4 and not 16x4.

The LiquidCrystal library that comes with the Arduino IDE does not handle the 16x4 displays correctly and the 'offset' will occur on the third and fourth lines with those displays. This problem has been around for several years.

Don

Edit: The part number on the back implies that it is a 16x4

Are you defining the display as 20x4?

lcd.begin(20, 4);

How !
Yes I did declare "lcd.begin(20, 4);" ... but floresta is right, I am wrong in the lcd size because it is a 16x4 and not 20x4. And the difference between 20 and 16 is just 4 8)
I feel confused :~
So it should work with the good device size declaration?
No. The same problem occurs while declaring "lcd.begin(16,4);", except if I maintain my modification in LiquidCrystal.cpp code for the row_offset[] setup. Surprising for me.

@floresta : OK I could have count the 16 elements on the line!!
but how did you find the correct device ?
I don't know which reference to look for on the web when I see several numbers on such a device ?

So it should work with the good device size declaration?

It should work but it won't because the library is broken. The library does not correctly handle the 16x4 displays. As I said before this problem has been around for several years.

LCD 16x4 setCursor is not working right - Interfacing - Arduino Forum September 19, 2009
LiquidCrystal 16x4 error - Bugs & Suggestions - Arduino Forum March 13, 2010
[solved] 16x4 LCD: Characters in row 3&4 are moved to the right - Displays - Arduino Forum June 06, 2011
Problem in LiquidCrystal lib (20x4) - Displays - Arduino Forum August 20, 2011
A 16 X 4 acting like 32 X 2 - Displays - Arduino Forum February 26, 2012
LiquidCrystal library error with PC1604 display - Displays - Arduino Forum September 28, 2013

Here is a thread with a very simple fix.
[solved] 16x4 LCD: Characters in row 3&4 are moved to the right - Displays - Arduino Forum June 17, 2012

Don

OK I could have count the 16 elements on the line!!
but how did you find the correct device ?
I don't know which reference to look for on the web when I see several numbers on such a device ?

These devices almost always have the display dimensions buried in the part number. The white tag on the back has the part number ECM1604-RN-YBS-01 so the 1604 was the tip-off.

Almost all of these devices use a controller based on the Hitachi HD44680U controller chip. Do a search for that number and you will find a 60 page datasheet published in 1999.

Don

Thanks a lot for all this valuable information !
It is a pleasure to find such a forum.
Sincerely.
Phil.