[Phpmyadmin-devel] PDF output in utf-8

Hi all I just committed support for creating PDF also in utf-8. It was needed to slightly modify FPDF to make this work, but it seems to work okay as far as I can test. Please verify if it didn't break anything and keep in mind for future FPDF updates that we have slightly modified version. -- Michal Čihař | http://cihar.com

Michal C(ihar( a écrit :
Hi all
I just committed support for creating PDF also in utf-8. It was needed to slightly modify FPDF to make this work, but it seems to work okay as far as I can test.
Please verify if it didn't break anything and keep in mind for future FPDF updates that we have slightly modified version.
Hi Michal, thanks for merging this! In ufpdf.php, I believe we need this: include_once './libraries/fpdf/fpdf.php'; Marc

Michal C(ihar( a écrit :
Hi all
I just committed support for creating PDF also in utf-8. It was needed to slightly modify FPDF to make this work, but it seems to work okay as far as I can test.
Please verify if it didn't break anything and keep in mind for future FPDF updates that we have slightly modified version.
Michal, I tried it, running in Czech UTF-8. I get those errors: Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422 Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 321 Notice: Uninitialized string offset: 9 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422 Notice: Uninitialized string offset: 9 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 321 Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422 Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 321 Notice: Uninitialized string offset: 9 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422 Notice: Uninitialized string offset: 9 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 321

Hi On Thu 30. 12. 2004 16:27, Marc Delisle wrote:
I tried it, running in Czech UTF-8. I get those errors:
Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422
Didn't you have iso-8859-1 texts somewhere in description or table name? -- Michal Čihař | http://cihar.com

On Thu 30. 12. 2004 16:39, Michal Čihař wrote:
Hi
On Thu 30. 12. 2004 16:27, Marc Delisle wrote:
I tried it, running in Czech UTF-8. I get those errors:
Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422
Didn't you have iso-8859-1 texts somewhere in description or table name?
Hmm, I can reproduce it on one server (php 4.3.10), but not on the one where I tested it (4.3.8)... Will look at that. -- Michal Čihař | http://cihar.com

On Thu 30. 12. 2004 16:48, Michal Čihař wrote:
On Thu 30. 12. 2004 16:39, Michal Čihař wrote:
Hi
On Thu 30. 12. 2004 16:27, Marc Delisle wrote:
I tried it, running in Czech UTF-8. I get those errors:
Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422
Didn't you have iso-8859-1 texts somewhere in description or table name?
Hmm, I can reproduce it on one server (php 4.3.10), but not on the one where I tested it (4.3.8)... Will look at that.
Should be okay now (as well as include path). -- Michal Čihař | http://cihar.com

Michal Čihař a écrit :
On Thu 30. 12. 2004 16:48, Michal Čihař wrote:
On Thu 30. 12. 2004 16:39, Michal Čihař wrote:
Hi
On Thu 30. 12. 2004 16:27, Marc Delisle wrote:
I tried it, running in Czech UTF-8. I get those errors:
Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422
Didn't you have iso-8859-1 texts somewhere in description or table name?
Hmm, I can reproduce it on one server (php 4.3.10), but not on the one where I tested it (4.3.8)... Will look at that.
Should be okay now (as well as include path).
Warnings are gone, thanks! I see one remaining problem: on the left side there are PDF bookmarks containing the table names, field names and $strRelationalSchema. Those are set by the Bookmark() function in pdf_schema.php, for example: $pdf->Bookmark($GLOBALS['strRelationalSchema']); Special characters (like é) do not appear correctly (in UTF-8) in the left side bookmarks. Can you reproduce this problem? Marc

Hi On Thu 30. 12. 2004 20:37, Marc Delisle wrote:
I see one remaining problem: on the left side there are PDF bookmarks containing the table names, field names and $strRelationalSchema. Those are set by the Bookmark() function in pdf_schema.php, for example:
$pdf->Bookmark($GLOBALS['strRelationalSchema']);
Special characters (like é) do not appear correctly (in UTF-8) in the left side bookmarks.
Can you reproduce this problem?
Well, I expected this. I never saw Czech PDF document that would have correct bookmarks :-). I'm afraid that bookmarks are iso-8859-1 only. -- Michal Čihař | http://cihar.com

Michal Čihař a écrit :
Hi
On Thu 30. 12. 2004 20:37, Marc Delisle wrote:
I see one remaining problem: on the left side there are PDF bookmarks containing the table names, field names and $strRelationalSchema. Those are set by the Bookmark() function in pdf_schema.php, for example:
$pdf->Bookmark($GLOBALS['strRelationalSchema']);
Special characters (like é) do not appear correctly (in UTF-8) in the left side bookmarks.
Can you reproduce this problem?
Well, I expected this. I never saw Czech PDF document that would have correct bookmarks :-). I'm afraid that bookmarks are iso-8859-1 only.
Michal, "bookmarks are iso-8859-1 only": are you saying this because this is the way the PDF format works? Marc

On Thu 30. 12. 2004 20:59, Marc Delisle wrote:
"bookmarks are iso-8859-1 only": are you saying this because this is the way the PDF format works?
I don't know much PDF internals, but bookmars are definitely handled another way than other text: they are stored just as text and are displayed in user interface and I never found way to specify encoding there. I thing this is "feature" of PDF, but I can be wrong. -- Michal Čihař | http://cihar.com

Michal Čihař a écrit :
Hi
On Thu 30. 12. 2004 16:27, Marc Delisle wrote:
I tried it, running in Czech UTF-8. I get those errors:
Notice: Uninitialized string offset: 7 in /var/www/html/phpMyAdmin-HEAD/libraries/fpdf/ufpdf.php on line 422
Didn't you have iso-8859-1 texts somewhere in description or table name?
Michal, I don't think so. I tried with English UTF-8 and get no error! But with Czech UTF-8 or French UTF-8, it generates errors. I made a test schema containing only this table: -- phpMyAdmin SQL Dump -- version 2.6.1-rc2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Dec 30, 2004 at 10:51 AM -- Server version: 4.0.20 -- PHP Version: 5.0.2 -- -- Database: `base2` -- -- -------------------------------------------------------- -- -- Table structure for table `persons` -- CREATE TABLE `persons` ( `id` tinyint(4) NOT NULL auto_increment, `person_name` varchar(200) NOT NULL default '', `town_code` varchar(5) default '0', `country_code` char(1) default NULL, `car_code` char(3) NOT NULL default '', `bike_code` int(11) NOT NULL default '0', `buglien` varchar(12) NOT NULL default '', PRIMARY KEY (`id`), KEY `town_code` (`town_code`), KEY `country_code` (`country_code`), KEY `pays-ville` (`country_code`,`town_code`) ) TYPE=InnoDB PACK_KEYS=1 DELAY_KEY_WRITE=1 COMMENT='table personnes aaa' AUTO_INCREMENT=2 ; -- -- Dumping data for table `persons` -- INSERT INTO `persons` VALUES (1, 'Marc', 'M', 'C', '5', 20, ''); -- -- Constraints for dumped tables -- -- -- Constraints for table `persons` -- ALTER TABLE `persons` ADD CONSTRAINT `persons_ibfk_37` FOREIGN KEY (`town_code`) REFERENCES `towns` (`town_code`), ADD CONSTRAINT `persons_ibfk_38` FOREIGN KEY (`country_code`) REFERENCES `countries` (`country_code`);
participants (2)
-
Marc Delisle
-
Michal Čihař