Page MenuHomePhabricator

Trim text input before saving on Structured Data on Commons string input
Open, Needs TriagePublic

Description

Trim text input before saving

Steps to reproduce:

  1. Copy a text with leading and/or trailing space(s) into a string-based statement (see screenshot)
  2. Paste it in a text field, like "name"
  3. Useless error appears

In this example a leading space in front of "Swiss Ruby"

grafik.png (501×804 px, 16 KB)

Possible solution:

  • use the parse API for strings in the UI

Event Timeline

Yes, ran into this too on Wikidata this week. The stripping could happen on the front end javascript or in the backend API. Not sure where other clean up is currently happening. AFAIK this only applies to string datatypes so I'll update the task a bit.

Multichill renamed this task from Trim text input before saving to Trim text input before saving on Wikibase string input.May 2 2020, 11:01 AM
Multichill updated the task description. (Show Details)

Any chance that this could be fixed in the near future? It's really annoying to run into the misleading error "wrong input". As I am an experienced user I know what to do (trim by hand) but other people with less experience would give up :-(

Putting it on my list to discuss with Adam next week.

Open question from my side: how do we deal with statements where the value is supposed to be only a whitespace? (I'm thinking of the Item for the whitespace character for example.)

Putting it on my list to discuss with Adam next week.

Open question from my side: how do we deal with statements where the value is supposed to be only a whitespace? (I'm thinking of the Item for the whitespace character for example.)

Those can't be added right now, so nothing would change there. For items about characters, I would suggest always using the P4213 (Unicode code point) value instead (especially if you're using SPARQL - T233204).

Isn't this ticket for Commons though, not Wikidata? There's already T47925 and T250695 for Wikidata, although it seems to be working fine for me there, e.g. I can no longer reproduce T261071.

Hi @Lucas_Werkmeister_WMDE, we now have built in Unicode normalization of string values already, right? So if we solved this task, it would automatically solve T47925 and others. In your opinion, could we just enable automated trimming in the parser? The case would be that we do not allow purely whitespace values in the UI, as I see no reason not move away from the working status quo. This seems like an obvious thing that we should do, but maybe I have missed something,

But still not the desktop UI of Structured Data on Commons :-( Tested a second ago.

Hm, looks like SDC doesn’t use the parse API, at least not for strings.

Screenshot from 2022-03-22 18-30-15.png (415×1 px, 44 KB)

Manuel renamed this task from Trim text input before saving on Wikibase string input to Trim text input before saving on Structured Data on Commons string input.Mar 23 2022, 2:17 PM
Manuel removed a project: Wikidata.
Manuel updated the task description. (Show Details)

Thank you! I have made the ticket more specific to SDC now, as this seems solved already for Wikibase.