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

amcat.upload.articles - Error Handling Emojis & more #10

Open
mrwunderbar666 opened this issue Jun 9, 2020 · 2 comments
Open

amcat.upload.articles - Error Handling Emojis & more #10

mrwunderbar666 opened this issue Jun 9, 2020 · 2 comments

Comments

@mrwunderbar666
Copy link
Contributor

I had issues uploading a large set to AmCAT via amcat.upload.articles.

Repeatedly got the error message: unable to escape string. String is not utf8

I isolated the bug to the package rjson which has certain difficulties handling correct encoding of utf-8 (e.g. see here: ramnathv/rCharts#446).

You can reproduce the bug rather easily with:

library(rjson)
emoji_string <- "I 💗 AmCAT 💥"
json_emoji <- rjson::toJSON(emoji_string)

But if you use the alternative package jsonlite then the string converts correctly:

emoji_string <- "I 💗 AmCAT 💥"
json_emoji <- jsonlite::toJSON(emoji_string)

I created an alternative function that uses jsonlite as backend.

A second minor problem is that the function amcat.upload.articles requires a headline parameter, but AmCAT requires a title field. I am not sure if this is specific to our implementation of AmCAT (autnes.amcat.nl) or just a naming issue of the fields.

A pull request will follow soon.

@vanatteveldt
Copy link
Member

I merged the pull request for now, but we should probably merge the two functions later.

@mrwunderbar666
Copy link
Contributor Author

Thanks,

this also raises the question whether emojis are desirable in AmCAT in the first place. I am not sure, if elasticsearch can index these correctly and thus become searchable with a query.

If I get around it, I try to implement a feature that would transform emojis to their alternative text versions (e.g. 👍 becomes :thumbsup:

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

No branches or pull requests

2 participants