0
votes

I have a problem with the cyrillic fonts. The user inserts some data in a MS SQL database and the data are well saved in the database in a nvarchar column. I mean that I can see the cyrillic fonts using a sql client like heideSQL in my case. When I use echo with php or I try to print out a pdf document with tFPDF I see just ????????. On the web browser I see cyrillic fonts without any problems.

Any suggestions?

here the code:

$sql="select text from table where user='xxxxxxx'";

$result=sqlsrv_query($db_conn, $sql);

while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) { echo $row['text'].'
'; }

and this is the result:

теÑÑ‚ 4 теÑÑ‚ 4 теÑÑ‚ 4 теÑÑ‚ 4 теÑÑ‚ 4

Thank you in advance

1
Are cyrillic fonts supported by tFPDF?Fakhruddin Ujjainwala
Yes. fpdf.org/en/script/script92.php . you can see an example here fpdf.org/en/script/ex92.pdf.user5986145
Can you share the PHP code that returns ????????David Rushton
When echo in php try use mb_convert_encoding for that cell. Try windows-1251 to UTF-8 for example.gofr1

1 Answers

0
votes

mea culpa:

to see the correct fonts on the browser is sufficient to intert this at the top of the page:

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

the result on the browser is this:

string: тест 5 encoding: UTF-8 string: тест 4 encoding: UTF-8 string: тест 4 encoding: UTF-8 string: тест 4 encoding: UTF-8 string: тест 4 encoding: UTF-8 string: тест 4 encoding: UTF-8

in the script there was an old query with an datatype conversion:

convert (TEXT, ...)

The TEXT datatype is deprecated. The solution was to convert it to NVARCHAR

convert (NVARCHAR, ...)

And also tFPDF works great.