Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-2173

Bitstream dowload fail when file name have some latin char like "é" or "ç".

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.1, 4.2
    • Fix Version/s: None
    • Component/s: JSPUI
    • Labels:
    • Environment:
      Ubuntu 14.04 Server 64, PostgreSQL
    • Attachments:
      0
    • Comments:
      4

      Description

      Bitstream dowload fail when file name have some latin char like "é" or "ç".
      After read some code i have added a utf-8 decode function in class BitstreamServlet.java, works fine for me, but i don't know if it's right for all dspace users and if is the best place to do this change.
      Anyone can plesase verify and add the change in github?

      The change was the addition of this new method:

      protected String UTF8toISO(String str)

      { Charset utf8charset = Charset.forName("UTF-8"); Charset iso88591charset = Charset.forName("ISO-8859-1"); ByteBuffer inputBuffer = ByteBuffer.wrap(str.getBytes()); // decode UTF-8 CharBuffer data = utf8charset.decode(inputBuffer); // encode ISO-8559-1 ByteBuffer outputBuffer = iso88591charset.encode(data); byte[] outputData = outputBuffer.array(); return new String(outputData); }

      ...and the use of the new inside the doDSGet method:

      String idString = UTF8toISO(request.getPathInfo());

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lucianovk Luciano Vieira Koenigkan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: