Skip to content

In grepl("\n", lines, fixed = TRUE) : input string 1 is invalid in this locale #396

Open
@wush978

Description

@wush978
Contributor

Dear @seankross ,

First, I want to thank the swirldev team of developing swirl. In the last semester, I used swirl to teach R in National Taiwan University. The feedback from the students are very positive and I think they love the style of learning R with swirl.

However, there is a an issue which bothers my students. On windows, the R keeps printing a warning message like:

In grepl("\n", lines, fixed = TRUE) :   
  input string 1 is invalid in this locale

Do you have any idea of the reason?

Best,
Wush

Activity

seankross

seankross commented on Jan 21, 2016

@seankross
Member

Hi @wush978,

That's amazing news! I would love to hear more about you experience using swirl in the classroom. What locale are your students using? Could one of them paste the result of sessionInfo() here? Also what's one example of a swirl question that shows the warning? I'll try to reproduce it.

Sean

wush978

wush978 commented on Jan 22, 2016

@wush978
ContributorAuthor

Hi @seankross ,

I am trying to create a minimal example of this issue, but I failed. After collecting more information and creating a reproducible example, I'll update it to here.

Thanks,
Wush

macnversion

macnversion commented on Sep 18, 2016

@macnversion

hi @seankross @wush978
I had same experiences weeks ago. Finally I find clear all history entries could fix it, but I don't understand why it would be this.

Best.

wush978

wush978 commented on Mar 11, 2017

@wush978
ContributorAuthor

Hi @seankross and @macnversion ,

I understand the reason.

I found some source and other IO functions which read the source code from file. On my courses, these scripts are stored with encoding UTF-8, but the default chinese encoding for Chinese Traditional windows users are BIG5. Similar issues might be occurred for other non-English courses.

The solution is to add the argument encoding = "UTF-8", in my case, to these functions or connections. More generally, providing the default encoding or a hook before parsing might be a more robust solution.

Best,
Wush

self-assigned this
on Mar 21, 2017
coverboy

coverboy commented on May 16, 2017

@coverboy

Thanks. @wush978 !!

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @coverboy@wush978@seankross@macnversion

      Issue actions

        In grepl("\n", lines, fixed = TRUE) : input string 1 is invalid in this locale · Issue #396 · swirldev/swirl