Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't support string in Chinese #530

Closed
tongWQ opened this issue May 4, 2017 · 1 comment
Closed

Doesn't support string in Chinese #530

tongWQ opened this issue May 4, 2017 · 1 comment
Labels

Comments

@tongWQ
Copy link

tongWQ commented May 4, 2017

Expected behavior

this patient's name is in Chinese
string patientName= file.Dataset.Get<string>(DicomTag.PatientName);
patientName's value supposes to be Chinese like "中文"

Actual behavior

patientName = ""??????""

Steps to reproduce the behavior

Open a dcm file which patient name or some other tag is in Chinese.

or

var file = DicomFile.Open(OpenFileDialog.FileName); file.Dataset.Remove(DicomTag.PatientName); file.Dataset.Add(DicomTag.PatientName,"中文"); file.Save(@"test.dcm");
then open "test.dcm", you will find out DicomTag.PatientName="??????"

fo-dicom version and OS/platform

[assembly: AssemblyCompany("fo-dicom")]
[assembly: AssemblyProduct("fo-dicom")]
[assembly: AssemblyCopyright("Copyright ?fo-dicom contributors 2012-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

[assembly: AssemblyVersion("3.0.0")]
[assembly: AssemblyFileVersion("3.0.0.4")]
[assembly: AssemblyInformationalVersion("3.0.0")]

OS:
Microsoft Windows 10 Professional 10.0.15063

@anders9ustafsson
Copy link
Contributor

@tongWQ I admit it is not straightforward right now, but what you need to do is to specify that you are using a multibyte Specific Character Set, ISO_IR 192 (UTF-8) or GB18030, and you also need to apply that character set when updating the patient name:

file.Dataset.AddOrUpdate(DicomTag.SpecificCharacterSet, "GB18030");
file.Dataset.AddOrUpdate(new DicomPersonName(DicomTag.PatientName, DicomEncoding.GetEncoding("GB18030"), "中文"));

As you can see, you cannot use the AddOrUpdate(DicomTag...) overload in this case, you need to use the AddOrUpdate(params DicomItem[]) overload.

If you follow these instructions, DICOM Dump will sufficiently display the patient name in Chinese:

in-chinese

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants