0

I'm trying to read a file (PDF) from my storage in android. The path is correct, but when i try to open the file, i get a message that says that file is not found, but i know that the file is there. When files that do not have special characters (accents) i have no problem.

When i go see the file in storage, it appears with two weird characters instead of "á". I dont even know how to write the first one, but its something like an ASCII character and the other is "ü".

Any solutions?

enter image description here

Thats the name of the file in my files viewer.

WitaloBenicio
  • 3,395
  • 5
  • 25
  • 32

1 Answers1

1

As far as i know, there was a bug reported against JVM and Android as well. i think it is fixed now.

I can suggest to use this method to get the file name or try other UTF encoded string instances

byte[] textArray = f.getName().getBytes("UTF-8");

I didn't test this but just a suggestion since you didn't provide how you did read the filename. and also please make sure you do the file existence if condition before you read the filename.

Kirk
  • 4,957
  • 2
  • 32
  • 59