Ignore:
Timestamp:
2017-10-30T22:46:09+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #15505 - update to metadata-extractor 2.10.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/drew/metadata/iptc/Iso2022Converter.java

    r10862 r13061  
    11/*
    2  * Copyright 2002-2016 Drew Noakes
     2 * Copyright 2002-2017 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    5959
    6060    /**
    61      * Attempts to guess the encoding of a string provided as a byte array.
     61     * Attempts to guess the {@link Charset} of a string provided as a byte array.
    6262     * <p>
    63      * Encodings trialled are, in order:
     63     * Charsets trialled are, in order:
    6464     * <ul>
    6565     *     <li>UTF-8</li>
     
    6868     * </ul>
    6969     * <p>
    70      * Its only purpose is to guess the encoding if and only if iptc tag coded character set is not set. If the
     70     * Its only purpose is to guess the Charset if and only if IPTC tag coded character set is not set. If the
    7171     * encoding is not UTF-8, the tag should be set. Otherwise it is bad practice. This method tries to
    7272     * workaround this issue since some metadata manipulating tools do not prevent such bad practice.
     
    7979     */
    8080    @Nullable
    81     static String guessEncoding(@NotNull final byte[] bytes)
     81    static Charset guessCharSet(@NotNull final byte[] bytes)
    8282    {
    8383        String[] encodings = { UTF_8, System.getProperty("file.encoding"), ISO_8859_1 };
     
    8585        for (String encoding : encodings)
    8686        {
    87             CharsetDecoder cs = Charset.forName(encoding).newDecoder();
     87            Charset charset = Charset.forName(encoding);
     88            CharsetDecoder cs = charset.newDecoder();
    8889
    8990            try {
    9091                cs.decode(ByteBuffer.wrap(bytes));
    91                 return encoding;
     92                return charset;
    9293            } catch (CharacterCodingException e) {
    9394                // fall through...
Note: See TracChangeset for help on using the changeset viewer.