    @Test
    public void testMergeJapanesePatientWithISOLATINStudy() throws IOException {


        Attributes patientAttrs = new Attributes();
        patientAttrs.setString(Tag.PatientID, VR.LO, "patID");
        patientAttrs.setString(Tag.IssuerOfPatientID, VR.LO, "issuer");
        Attributes otherids = new Attributes();
        otherids.setString(Tag.PatientID, VR.LO, "otherID");
        patientAttrs.newSequence(Tag.OtherPatientIDsSequence, 1).add(otherids);
        patientAttrs.setBytes(Tag.PatientName, VR.LO,
                SpecificCharacterSetValues.JAPANESE_PERSON_NAME_JISX0201_BYTES);
        String[] patientCodecs = new String[] { "ISO_IR 13", "ISO_IR 87" }; // JIS_X_201/JIS_X_208
        patientAttrs.setString(Tag.SpecificCharacterSet, VR.CS, patientCodecs);

        assertTrue(new HashSet<String>(Arrays.asList(patientCodecs))
                .equals(new HashSet<String>(Arrays.asList(patientAttrs
                        .getSpecificCharacterSet().toCodes()))));

        assertTrue(Arrays.equals(
                new Attributes(patientAttrs).getBytes(Tag.PatientName),
                SpecificCharacterSetValues.JAPANESE_PERSON_NAME_JISX0201_BYTES));

        assertTrue(new Attributes(patientAttrs)
                .getString(Tag.PatientName)
                .equals(SpecificCharacterSetValues.JAPANESE_PERSON_NAME_JISX0201));

        Attributes studyAttrs = new Attributes();
        String[] studyCodecs = new String[] { "ISO_IR 100" }; // ISO_8859_1
        studyAttrs.setString(Tag.StudyInstanceUID, VR.UI, "studyID");
        studyAttrs.setString(Tag.SpecificCharacterSet, VR.CS, studyCodecs);

        Attributes seriesAttrs = new Attributes();
        seriesAttrs.setString(Tag.SeriesInstanceUID, VR.UI, "seriesID");

        Attributes instanceAttrs = new Attributes();
        instanceAttrs.setString(Tag.SOPClassUID, VR.UI, "1.2.3.4");
        instanceAttrs.setString(Tag.SOPInstanceUID, VR.UI, "4.3.2.1");

        Attributes mergedAttrs = Utils.mergeAndNormalize(patientAttrs,
                studyAttrs, seriesAttrs, instanceAttrs);

        String[] expectedMergedCodecs = new String[] { "ISO_IR 192" }; //UTF-8
        
        assertTrue(new HashSet<String>(Arrays.asList(expectedMergedCodecs))
                .equals(new HashSet<String>(Arrays.asList(mergedAttrs
                        .getSpecificCharacterSet().toCodes()))));

        assertTrue(Arrays.equals(
                new Attributes(mergedAttrs).getBytes(Tag.PatientName),
                SpecificCharacterSetValues.JAPANESE_PERSON_NAME_UTF8_BYTES));

        assertTrue(new Attributes(mergedAttrs)
                .getString(Tag.PatientName)
                .equals(SpecificCharacterSetValues.JAPANESE_PERSON_NAME_JISX0201));

    }