<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 30, 2017 at 8:52 PM, Ang <span dir="ltr"><<a href="mailto:ysa0829@gmail.com" target="_blank">ysa0829@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi David,<br>
<br>
My character default setting is UTF-8 and the Transfer Syntax UID is<br>
"1.2.840.10008.1.2.4.91"<br>
.<br>
<br>
Finally, I found the solution that gdcmReader needs the filename to be<br>
ansi(I guess), I add below code in vtkDICOMReader at line 1460 to 1470.<br>
<br>
******************************<wbr>*****************<br>
<br>
gdcm::ImageReader reader;<br>
<br>
int len = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);<br>
wchar_t* wfilename = new wchar_t[len + 1];<br>
memset(wfilename, 0, len * 2 + 2);<br>
MultiByteToWideChar(CP_UTF8, 0, filename, -1, wfilename, len);<br>
len = WideCharToMultiByte(CP_ACP, 0, wfilename, -1, NULL, 0, NULL, NULL);<br>
char* szfilename = new char[len + 1];<br>
memset(szfilename, 0, len + 1);<br>
WideCharToMultiByte(CP_ACP, 0, wfilename, -1, szfilename, len, NULL,<br>
NULL);<br>
std::string strTemp(szfilename);<br>
if (wfilename) delete[] wfilename;<br>
if (szfilename) delete[] szfilename;<br>
reader.SetFileName(strTemp.c_<wbr>str());<br>
<br>
******************************<wbr>**********************<br>
<br>
Is this solution better?<br></blockquote><div><br></div><div><br></div><div>Yes, that is the correct solution, since your ANSI character set is Chinese.</div><div>Because vtkDICOMReader uses gdcm for decompression, it is necessary</div><div>to do this conversion if you use any compressed transfer syntax.</div><div><br></div><div>Most of the VTK readers use ANSI on Windows. Personally, I think that it</div><div>would be better if they all used utf-8 (and if gdcm used utf-8, too). Especially</div><div>since the the native character set on Windows and NTFS is Unicode.</div><div><br></div><div> - David</div><div> <br></div></div></div></div>