# cornerstoneDicomParserUTF8

### Introduction
For the RadioLogic project started two years ago, I needed a DICOM parser supporting UTF8 encoded data.

RadioLogic is a teaching and assessment tool for radiologists, work in progress. It's a webapp optimized for use on iPAD's.

In a first step I succesfully patched Chris Hafey's distribution file *dicomParser.js* to parse the RadioLogic teaching files. I now took time to modify the source files, document the changes and build new distribution files.

For different reasons I prefer to present the results in my own way, instead of using a standard GitHub fork.

### Changes
I tried to integrate the UTF8 support in the dicomParser with a minimum of code change. For this reason the modifications done are not optimal.

##### byteArrayParser.js
A new export function **readFixedStringUTF8()** is added. The uit8array to utf8 string conversion uses the native **decodeURIComponent()** function and is based upon the code published by [Petka Antonow](http://jsfiddle.net/Z9pQE/).

##### dataSet.js
The **string()** and **text()** functions are modified to to use the new readFixedStringUTF8 function if the DICOM data is encoded with ISO_IR 192.

##### index.html of dumpWithDataDictionary
The dragAndDrop FileHandler is replaced by a simple input FileReader to make it work on tablets (iCloud, iDrive, ...). 

The *stringIsAscii = isASCII(str)* test is replaced by the assignment *stringIsAscii = true*.

The closing body tag is moved to the end of the file to make the code W3C compliant.

##### dataDictionary.js of dumpWithDataDictionary
The private RadioLogic tags with group number 4321 are added to the dictionary.

### Installation 