5

I am getting the unexpected input error in UI.R, as follows:

ERROR: C:\Users\myApp/ui.R:1:2: unexpected input 
1: ï»

However, when I try to locate the error at line 1, there is absolutely nothing of the form ï».

To resolve this error, I tried saving my UI.R file as a text file and changing the encoding to UTF-8, but this still does not remove the strange character. I also tried removing the first couple of lines and re-writing the code, but it still gives the same error!

How can I remove this character? Should I use another text editor? I am using base R, not R Studio. And I had copy-pasted my code form my GitHub account, if that info is required... Code from my file can be viewed here.

Many thanks.

info_seekeR
  • 1,296
  • 1
  • 15
  • 33
  • 4
    The answers to [this question](http://stackoverflow.com/questions/3255993/how-do-i-remove-%C3%AF-from-the-beginning-of-a-file) might be helpful. – Matthew Plourde Jul 19 '14 at 14:12
  • 1
    @MatthewPlourde thanks a lot! BOM (Byte Order Mark) is indeed what appears at the start of my text file. To solve the problem, I used my editor to encode in UTF-8 without BOM. Matthew, if you would include your comment (plus any text from the link you provided) as an answer, I would be able to upvote it and select as an answer :) – info_seekeR Jul 22 '14 at 20:36

1 Answers1

1

I have this same issue in the year '19, and took me a while to run into this question from the year '14.

Not Shiny, but a regular R project with its .Rprofile.

The solution that worked for me is:

Open your file in Notepad++. From the Encoding menu, select Convert to UTF-8 (without BOM), save the file, replace the old file with this new file. And all is fixed.

Diego-MX
  • 2,279
  • 2
  • 20
  • 35