View Issue Details

IDProjectCategoryView StatusLast Update
0023891mantisbtdb mssqlpublic2019-02-08 11:16
ReporterNuxunux Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformIIS,SQL Server 2012,PHP 5.5.38OSWindows ServerOS Version2012 R2
Product Version2.10.0 
Summary0023891: MSSQL 2012 can't show Chinese_Traditional
Description

MSSQL 2012 can't show Chinese_Traditional

SQL Server 2012 儲存中文時皆亂碼

中文在網頁可正常顯示,但有些文字會導致顯示空白,即使將資料庫欄位改為nvarchar也無效

上傳圖片也無法使用

Steps To Reproduce

1) Under IIS, setup SQL Server 2012 Enterprise, PHP 5.5.38, sqlsrv
2) Unzip Mantis files to wwwroot
3) Open http://yoursite/mantisbt/admin/install.php
4) Set SQL Native Driver connect,Time Zone Taipei
6) Create DB , Set Chinese_Taiwan_Stoke_CI_AS
7) Run the install
8) DB can't show Chinese

TagsNo tags attached.
Attached Files

Relationships

has duplicate 0024791 closedatrol Unable to save Chinese characters in MSSQL database 

Activities

samnchiu

samnchiu

2018-03-04 22:54

reporter   ~0059078

Hi Nuxunux,

I meet the same issue and fixed it.
The root cause is the php to connect the mssql not use the utf8 characterSet.
So I modify the database_api.php(refer the attachment database_api_php.htm) and it's work(see the show_chinese_correct.jpg).

But the elder values in database is use the default characterSet (maybe ansi code),
so you will see the garbled after you modify the database_api.php

For solving the garbled issue, i coding some simple php to read the value use the default characterSet,
and then using these values that i coding some sql to update these elder data.

For your reference.

Hi Nuxunux,

我也遇到一樣的問題,我發現原因在php 去連線mssql 的時候沒有使用utf8 characterSet.
所以我修正了database_api.php (參考附加檔案的報告 database_api_php.htm),我確定可以使用。

但因為原本資料庫裏面的繁體中文都使用預設的characterSet (可能是ansi),所以當程式修改後,
原本的那些繁體中文會變成亂碼。

我是額外去寫了簡單的php 使用預設的characterset 把那些舊的資料都讀出來,然後自己再另外撰寫sql 去回寫回資料庫。
或許你可以參考這個方法。

以上供參考。

database_api_php.htm (536,811 bytes)
show_chinese_correct.jpg (293,488 bytes)   
show_chinese_correct.jpg (293,488 bytes)   
samnchiu

samnchiu

2018-03-06 20:37

reporter   ~0059098

After I modify the characterset in connect, i found i cannot upload the image anywhere.

I trace the issue and I found the content column in mantis_bug_file_table,
that should use the adb updateblob ($g_db->UpdateBlob) function.

So I modify two php code and it's work.(Refer the attachment report).

Otherwise, the content column in mantis_bug_file_table, it must allow Null.
Because image upload insert the image information first and then update the content use updateblob,
in insert stage the content is null.

F.Y.R

我修改characterset 之後發生了圖片檔案無法上傳的問題。
追蹤了這個錯誤後,我發現image 必須要另外使用adophp 的updateblob去處理。

修改內容請參考report。

另外,mantis_bug_file_table 的content 欄位必須要允許null.
因為上傳圖片是先新增一筆圖片資訊,之後再更新content 欄位的,如果沒有先允許null,會報錯。

以上供參考。

file_api_php.htm (466,744 bytes)
database_api_php_2.htm (537,480 bytes)
leontai

leontai

2019-02-08 11:16

reporter   ~0061454

@samnchiu
Thank you so much. You saved my life.