Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbook show error with multibyte string #202

Closed
junpei-n opened this issue Jul 15, 2022 · 0 comments
Closed

workbook show error with multibyte string #202

junpei-n opened this issue Jul 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@junpei-n
Copy link
Contributor

junpei-n commented Jul 15, 2022

When the length of a sheetname is larger than 20 and it is a multibyte string, XLSX.readxlsx raises StringIndexError.

julia>  
       using XLSX
       f = "sample.xlsx"
       
       XLSX.readxlsx(f)

XLSXFile("sample.xlsx") containing 18 Worksheets
            sheetname size          range        
-------------------------------------------------
ERROR: StringIndexError: invalid index [20], valid nearby indices [19]=>'', [22]=>''

The bug, at workbook.jl#L76, can be fixed like

        name = s.name |> x -> length(x) > 20 ? join(collect(x)[1:20])*"" : x
        # x[collect(eachindex(x))[1:20]] may be better

, however, it would print an undesired length string like

            sheetname size          range        
-------------------------------------------------
あいうえおかきくけこさしすせそなにぬねの_2022… 133x34        B1:AI133
@felipenoris felipenoris added the bug Something isn't working label Jul 15, 2022
YongHee-Kim added a commit to YongHeeK/XLSX.jl that referenced this issue Aug 31, 2022
felipenoris pushed a commit that referenced this issue Aug 31, 2022
* Fix for #202

* remove redundancy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants