Skip to content

Support for file extensions using uppercase letters #251

Open

Description

@cbdavis

I'm running into problems when trying to read Excel files with uppercase extensions:

filename = "test.XLS"
df = DataFrame(load(filename, "Sheet1"))

Leads to

ERROR: NoDecodeDelegateForThisImageFormat `XLS' @ error/constitute.c/ReadImage/560

When I rename the file to test.xls everything works fine.

I'm also able to get things to work by changing the code here:

add_format(format"Excel", (), [".xls", ".xlsx"], [:ExcelFiles])

to:

add_format(format"Excel", (), [".xls", ".xlsx", ".XLS", ".XLSX"], [:ExcelFiles])

I see that a few formats have definitions for upper and lowercase variants of the file extensions, although it seems like it would be more ideal to just convert the extension string to lower case when trying to figure out which format the file is in.

This might be related to #236

Activity

  1. SimonDanisch commented on Jan 13, 2020

    @SimonDanisch
    Member

    I find it bad style to support uppercase and lowercase extensions, which probably only a few extension vendors started doing. So I'm in favor of keeping this explicit for the few formats, that started allowing the uppercase version...

  2. oxinabox commented on Mar 17, 2021

    @oxinabox
    Contributor

    I don't think I agree. or at least not entirely.
    File format when recogizing by extension (rather than magic byte) should be done in a case-insensitive way.
    E.g. convert all of them to lower case before comparing.

    Remembing that Windows historically uses a a case-insesitive file-system;
    and also historically depended a lot more on the extension to decide what to do with a file.
    In contrast to Unixen which has things like the shebang line to specfy interpretter.

    I think it would be very weird to have a file extension that has to be in upper-case as the one way it is distinguished from another, simply because that wouldn't work in Windows.

  3. JohsEnevoldsen commented on Dec 28, 2021

    @JohsEnevoldsen

    I ran into this issue with RData.jl. It not obvious to me (a Julia beginner) that capitalization of the file extension was the problem. I filed an issue at RData.jl (JuliaData/RData.jl#91).

  4. nalimilan commented on Feb 6, 2022

    @nalimilan
    Member

    This has been reported again in RData. This might be a relatively exceptional case, but both "RData" and "Rdata" are widely used. FileIO already accepts both "RData" and "rdata", I guess we could add "Rdata" to the list but having something more systematic would be nice.

  5. nalimilan commented on Feb 6, 2022

    @nalimilan
    Member

    BTW, we already support both "jpg" and "JPG", .stl" and ".STL", ".fit" and ".FIT", ".fits" and ".FITS", ".fts" and ".FTS", ".mid" and ".MID", so it seems to me that case sensitivity really doesn't make sense in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions