apps-android-commons icon indicating copy to clipboard operation
apps-android-commons copied to clipboard

Can not type Japanese space in caption field

Open nicolas-raoul opened this issue 3 years ago • 3 comments

This is the Japanese space character:   It is wider than the non-Japanese space character. While not used as often, it can still be useful to separate expressions.

When uploading a picture with the app, this character can not be typed into the caption field. When I type the space character on the phone's keyboard, nothing happens. Pasting it does not work either, the character is removed from the pasted text.

With the Commons website I can enter Japanese spaces in the filename, caption, description fields. After pressing "Publish", the Japanese space of the filename field is converted to a non-Japanese space. Example: https://commons.wikimedia.org/wiki/File:%E5%BA%83%E5%B0%BE_%E3%82%AD%E3%83%A9%E3%82%AD%E3%83%A9%E3%83%80%E3%83%B3%E3%83%97%E3%82%AB%E3%83%BC.jpg

How about doing like the web UI?

  1. Allow the Japanese whitespace in fields.
  2. Transform it into a non-Japanese whitespace before uploading.

I am pretty sure we still have a method somewhere that sanitizes a few "bad" characters before upload. We could stop blocking these few characters in UploadMediaDetailInputFilter.java.

If you notice any other character that has the same issue, please comment below, thanks!

Context: https://github.com/commons-app/apps-android-commons/pull/4955

nicolas-raoul avatar May 30 '22 06:05 nicolas-raoul

hi,I think maybe I can try this bug, could you assign it to me?

zhihaoyuu avatar Oct 13 '22 06:10 zhihaoyuu

I think the solution to this problem is to add a method such as "jpSpace2EnSapce" to be called in the filter. In this way, and when the query enters Japanese spaces, it is converted into English space. I will try to complete the method

zhihaoyuu avatar Oct 13 '22 07:10 zhihaoyuu

@zhihaoyuu It is yours 🙂

nicolas-raoul avatar Oct 13 '22 14:10 nicolas-raoul

@zhihaoyuu Does your solution actually solve it? I've given your code a go and it seems I cannot type in a Japanese space in the caption field still.

Anjun-Feng avatar Oct 21 '22 08:10 Anjun-Feng

@zhihaoyuu Does your solution actually solve it? I've given your code a go and it seems I cannot type in a Japanese space in the caption field still.

hi, I just tested it too and I think I found the real problem. The real problem is that when your language setting in the emulator is English, you can only type in English, no other languages are allowed. But if you switch to Japanese, you can type any Japanese normally (including Japanese spaces) The following screenshot is the input of Japanese space, it can be displayed: image image

zhihaoyuu avatar Oct 21 '22 15:10 zhihaoyuu

Oh, I see. setting the language as Japanese was what I didn't think about. Thanks for your reply :)

Also, please ignore my own repo if it appears. It is just my approach for my group assignment in which we chose to analyze and solve issues for this project. I'm all new to an open source (guess I shouldn't reference the issue).

Anjun-Feng avatar Oct 22 '22 02:10 Anjun-Feng

@zhihaoyuu Also, I'm a bit confused about your code. image I have the following doubts:

  1. Why is your code all green? I think you've only added and used the method jpSpace2EnSapce.
  2. Why are there two duplicate lines? Additionally, I think by having it without a comma at the end of the first line, the IDE would give an error and not let it compile.

Anjun-Feng avatar Oct 22 '22 03:10 Anjun-Feng

thanks for your question. q1:At first I created the method to convert Japanese space to English space, but it seems that the problem is not this, the problem is that the software only allows input in the language you set. so in fact, you just need to manually switch to the Japanese input method. just ignore this code( we don't need it now)

q2:yes it was a bug, I added one less ";", if you want it to work, just add it manually

zhihaoyuu avatar Oct 22 '22 04:10 zhihaoyuu