Project

General

Profile

« Previous | Next » 

Revision e082affd

Added by Andreas Kohlbecker over 7 years ago

fix #6035 character replacement rules

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/iapt/IAPTActivator.java
37 37

  
38 38
    public static final String DATA_FILE_0_100 = "fileURI-100.xls";
39 39
    public static final String DATA_FILE_FULL = "Registration_DB_from_BGBM17.xls";
40
    public static final String DATA_FILE = DATA_FILE_0_100;
40
    public static final String DATA_ENCODING_PROBLEMS = "encoding-problems.xls";
41
    public static final String DATA_FILE = DATA_ENCODING_PROBLEMS;
41 42

  
42 43
    //database validation status (create, update, validate ...)
43 44
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java
388 388
     */
389 389
    private String getValue(HashMap<String, String> record, String originalKey, boolean doUnescapeHtmlEntities) {
390 390
        String value = record.get(originalKey);
391

  
392
        value = fixCharacters(value);
393

  
391 394
        if (! StringUtils.isBlank(value)) {
392 395
        	if (logger.isDebugEnabled()) {
393 396
        	    logger.debug(originalKey + ": " + value);
......
402 405
        }
403 406
    }
404 407

  
408
    /**
409
     * Fixes broken characters.
410
     * For details see
411
     * http://dev.e-taxonomy.eu/redmine/issues/6035
412
     *
413
     * @param value
414
     * @return
415
     */
416
    private String fixCharacters(String value) {
417

  
418
        value = StringUtils.replace(value, "s$K", "š");
419
        value = StringUtils.replace(value, "n$K", "ň");
420
        value = StringUtils.replace(value, "e$K", "ě");
421
        value = StringUtils.replace(value, "r$K", "ř");
422
        value = StringUtils.replace(value, "c$K", "č");
423
        value = StringUtils.replace(value, "z$K", "ž");
424
        value = StringUtils.replace(value, "S>U$K", "Š");
425
        value = StringUtils.replace(value, "C>U$K", "Č");
426
        value = StringUtils.replace(value, "R>U$K", "Ř");
427
        value = StringUtils.replace(value, "Z>U$K", "Ž");
428
        value = StringUtils.replace(value, "g$K", "ǧ");
429
        value = StringUtils.replace(value, "s$A", "ś");
430
        value = StringUtils.replace(value, "n$A", "ń");
431
        value = StringUtils.replace(value, "c$A", "ć");
432
        value = StringUtils.replace(value, "e$E", "ę");
433
        value = StringUtils.replace(value, "o$H", "õ");
434
        value = StringUtils.replace(value, "s$C", "ş");
435
        value = StringUtils.replace(value, "t$C", "ț");
436
        value = StringUtils.replace(value, "S>U$C", "Ş");
437
        value = StringUtils.replace(value, "a$O", "å");
438
        value = StringUtils.replace(value, "A>U$O", "Å");
439
        value = StringUtils.replace(value, "u$O", "ů");
440
        value = StringUtils.replace(value, "g$B", "ğ");
441
        value = StringUtils.replace(value, "g$B", "ĕ");
442
        value = StringUtils.replace(value, "a$B", "ă");
443
        value = StringUtils.replace(value, "l$/", "ł");
444
        value = StringUtils.replace(value, ">i", "ı");
445
        value = StringUtils.replace(value, "i$U", "ï");
446
        // Special-cases
447
        value = StringUtils.replace(value, "&yacute", "ý");
448
        value = StringUtils.replace(value, "<L", "Ł");
449
        value = StringUtils.replace(value, "E>U$D", "З");
450
        value = StringUtils.replace(value, "S>U$E", "Ş");
451
        value = StringUtils.replace(value, "s$E", "ş");
452

  
453
        return value;
454
    }
405 455

  
406 456

  
407
	/**
457
    /**
408 458
	 *  Stores taxa records in DB
409 459
	 */
410 460
	@Override

Also available in: Unified diff