DCM4CHE cannot display Japnese Character - c++

I am using dcm4che as my PACS and I am inserting a DICOM file which contains the patient name in Japanese character.
But the web based url of dcm4chee is not supporting Japanese character and showing the patient name as garbled characters( like question marks and squares ).
For DCM4CHE i am using postgresql as the DataBase. In DB properties it is showing 'Encoding as UTF8', 'Collation as English_India.1252' and 'Character Type as English_India.1252'. Does my DB supports Japanese character ?
I am new to Database and any help will be appreciated.
EDIT:
This issue was not related to PACS. I obtained a valid DICOM file with Japanese charters( they are using specific character set as \ISO 2022 IR 87 ) and send the same to PACS. Its correctly showing in the PACS. So the issue is with my DICOM file. I also inserted the specific character set as '\ISO 2022 IR 87'. But still I am getting garbled japanese characters.
I am using MergeCom Dicom utility and using 'MC_Set_Value_From_String' API for inserting the japanese string. Am I missing anything ? Is it not possible to insert Japanese characters by using 'MC_Set_Value_From_String' ? I am thinking of using the API MC_Set_Value_From_UnicodeString.

UTF-8 supports all unicode code points, which includes Japanese. So it is unlikely the database is the issue.
What is the content of the Specific Character Set (0008,0005) tag? The default character encoding for dicom is ASCII. There is a section in the dicom spec providing examples of use with Japanese.

I could solve the issue.
The issue was related to the encoding. For Unicode conversion, I was using the windows API "WideCharToMultiByte" with code page was UTF-8. This was not properly converting the Japanese characters which was fixed by using code page as 50222.
You can find all the entire code page from below link.
https://msdn.microsoft.com/en-us/library/dd317756(VS.85).aspx

Related

How to fix 'Imported file has a wrong encoding: 'charmap' codec can't decode byte 0x9d in position 21221: character maps to' error?

I'm trying to import a csv file to my django project. Until now, the previous times I did this i never had a problem. However, all of a sudden I keep getting this error that says "Imported file has a wrong encoding: 'charmap' codec can't decode byte 0x9d in position 21221: character maps to" when i try to import the csv file in.
I don't understand why I am getting the error
[![enter image description here][1]][1]
this is what i keep getting.
I am trying to import my excel file like this:
[![enter image description here][2]][2]
and this is what my csv file looks like:
[![enter image description here][3]][3]
\
The csv file contains invalid data for the encoding that you are attempting to interpret it with. Depending on how it was generated, you might be able to tell Python what is the correct decoding to apply when you open it
f = open(csv_file_name, encoding= ...)
or you might specify an appropriate encoding when you generate the csv file, or you might be processing dodgy data and have to resort to encoding="latin-1" -- which may result in putting bad data in to your database, if you don't validate what comes out of the csv file through a Django form before saving it.
I'd recommend always processing rows of csv data through Django forms or modelforms. It makes it very easy to catch errors (form is not valid, form.errors, etc. ) and print out useful error messages about what is wrong with which field (column) of the row.
Lots more here and here
Hex character 9d is not a printable character (https://www.codetable.net/hex/9d). In unicode it appears to be some kind of command. You will need to sanitise this character to be able to handle it in a csv file.
Edit: As #snakecharmerb points out in the comments, there are encodings where this is a valid character. However, I suspect from your question that you are not using one of these.
You can also look into decode to allow you to specify a charset for reading the data. If you have a charset that you think this is a valid char for, then perhaps your routine is picking up a different default charset from the system.
I actually do something like this to make sure I get Swedish chars properly set. This is directly from my code when extracting fields
output.decode('iso-8859-1').strip()

How are unicode values encoded in Google Cloud Load Balancer custom headers?

When using Google Cloud Load Balancer, you can add certain fields to custom headers such as {client_city}, which (surely?) are unicode strings.
I cannot find in the documentation how these are encoded in the header (bearing in mind that HTTP headers are ASCII only, or possibly Latin-1 according the "obsolete" productions in the HTTP RFC).
Since I'm in a city with an ASCII name, I've not been able to run a test from my local box.
Google has a document for this:
client_city:
Name of the city from which the request originated, for
example, “Mountain View” for Mountain View, California. There is no
canonical list of valid values for this variable. The city names may
contain US-ASCII letters, numbers, spaces, and the following
characters: !#$%&'*+-.^_`|~.
Some headers can be Unicode, whereas some well known headers are Ascii.
https://cloud.google.com/load-balancing/docs/backend-service

Django character latin1 mysql

I create a django application with existing MySQL database, the problem is the encoding to database is latin1_general_c and the utf8 characters is save like this ñ => ñ , ó => ó, i need present the information in that page in correctly form but django show the information of database like this
recepción, 4 oficinas, 2 baños
i need show like this
recepcíon, 4 oficinas, 2 baños
For many reasons I can't change the database to utf8
what do I do for show information the correctly way?
Django seems to explicitly require that your database use UTF-8:
Django assumes that all databases use UTF-8 encoding. Using other encodings may result in unexpected behavior.
That said, it should be possible to use the custom OPTIONS setting to pass the desired character set to the database driver. See this answer, in which setting charset solved the problem. But you should check the documentation for the specific MySQL driver and database that you're using, since these options are not used by Django itself.
As suggested by the quote above, even if this works to correctly translate strings between the database and unicode, parts of Django still won't work correctly. For example, to correctly validate the length of a CharField Django has to know the encoding, and it will always assume UTF-8.

Dash ("–") breaks aspose.pdf xsl-fo

I have an xsl-fo xslt file, and it generates blank pages, along with the standard "An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem" error message.
I found that the issue was due to the text I was writing into the pdf contained dashes "–" and when I removed characters, the pdf was rendered successfully.
does anyone know why this "–" character would cause the xsl-fo pdf process should fail? everything I have read says this is not a special character and I shouldn't worry about encoding it.
Update here is a link to the Aspose forum's post I created:
http://www.aspose.com/community/forums/permalink/593149/593149/showthread.aspx#593149
Update #2 I found the issue was not the forward slash, but an encoding issue with dashes (I have updated the questions content, sorry for the confusion) at this point i am still looking for an answer, but I confused the differences between my working xml data, and my not working xml.

Builder c++ Rave Reports encoding problem with cyrillic

When i try save rave project in pdf\html file, have incorrect encoding.
When choose format and press SAVE, it ussually save in iso-8859-1 code.
But i need cp1251 (cyrillic).
For example "Ïëîùàäü" instead of "Площадь".
I would guess that the best solution to your problem would be to use Unicode, rather than a codepage such as CP1251. Is it possible to use Unicode with Rave Reports?
I have the same problem when I want o save reprt to pdf format. I have to create TRvRenderPDF and set it as RenderObject but pdf file was viewed not correctrly.
The TRvRenderPDF component not unicode-compatible(that is very bad) that is why all text in report coverted into Ansi with active codepage(for cyrillic it is CP1251). Now we have pdf file with text in CP1251 encoding.
As default TRvRenderPDF generate pdf with font TYPE1 Helvetica(by the standart of the format pdf it is build-in). But text is interpreted with encoding ISO 8859-1(or CP1252) but it encoding was CP1251 tha is why we have "Ïëîùàäü" or something analogous.
What we can to do:
Get font TYPE1(CP1252) where service symbols(numbers like in cyrillic letters in CP1251) replaced with cyrillic glyphs. For example a link and we need to install it.
Now we need tor replace old font name(Helvetica) from generated pdf document with new font name(AGHelvetica). You can dow it with text editor or i your's programm(read file -> find -> replace -> save file).
That all situation.
P.S. Sorry for my english.
P.P.S. If set property of pdf render EmbedBaseFonts = true, pdf document were saved with TrueType fonts, but problem stay. Neew to see to unicode render? but not this one.