Skip to content

fix non-utf8 channel name handling#5

Merged
zach-snell merged 1 commit into
zach-snell:masterfrom
any1one:master
Jan 12, 2019
Merged

fix non-utf8 channel name handling#5
zach-snell merged 1 commit into
zach-snell:masterfrom
any1one:master

Conversation

@any1one

@any1one any1one commented Nov 17, 2018

Copy link
Copy Markdown

when backing up a channel with chinese characters, got his error :

Traceback (most recent call last):
  File "slack_export.py", line 369, in <module>
    fetchPublicChannels(selectedChannels)
  File "slack_export.py", line 126, in fetchPublicChannels
    print("Fetching history for Public Channel: {0}".format(channel['name']))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

encoding channel name to utf8 fix it

@zach-snell zach-snell merged commit 66e2e1b into zach-snell:master Jan 12, 2019
@rueycheng

Copy link
Copy Markdown

Unfortunately this patch doesn't work with non UTF-8 channel names. For example, if you fire off the export script with --publicChannels general you'll end up with two directories, b'general' and general, rather than just one. JSON files are dumped to the first directory, leaving the second empty, which would later trigger a 500 error when you fire up slack-export-viewer.

Undoing this PR solves the problem on my side (python 3.7.4, macos 10.14.6)

@jcul

jcul commented Jan 2, 2020

Copy link
Copy Markdown

Yes, this pull request creates lots of duplicate folders.

@zach-snell

Copy link
Copy Markdown
Owner

Feel free to make a pull request with an adjustment or a rollback and I will merge it though.
Thanks!

I have not worked on this in a while since it has limited interest but am happy to merge in valid adjustments.

@jcul

jcul commented Jan 6, 2020

Copy link
Copy Markdown

I submitted pull request #20 to undo these changes until a better solution is found.
I did some tests with unicode characters in channel names and didn't experience the same issues.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants