I have a bunch of text files with filenames that contain non-ASCII characters. For example this is a title:
readLines('bbb/ović, Melika_ Omeragić, Ismir_ Bata.txt')
## Error in file(con, "r") : cannot open the connection
## In addition: Warning message:
## In file(con, "r") :
## cannot open file 'bbb/ovi?, Melika_ Omeragi?, Ismir_ Bata.txt': Invalid argument
I try:
dir('bbb')
## [1] "ovic, Melika_ Omeragic, Ismir_ Bata.txt"
So I tried:
readLines(list.files('bbb', full.names = TRUE))
## Error in file(con, "r") : cannot open the connection
## In addition: Warning message:
## In file(con, "r") :
## cannot open file 'bbb/ovic, Melika_ Omeragic, Ismir_ Bata.txt': No such file or directory
How can I programatically read these files in? The content of the files is of no matter to this questions, just the special characters in the file names and reading the files in.
If need be if there's a way to changing the file names in order to read them in I'm open to that as well.
I realize I have no MWE but can't create one for this problem. Simply generating a text file and naming it: ović, Melika_ Omeragić, Ismir_ Bata.txt
and using the code I have above to read it in will illustrate the problem.