Problem/Motivation
When typing in Chinese a comma is represented as ',' rather than ','. The first character is Unicode U+FF0C ‘Fullwidth Comma', the second character used in the West is U+002C. Separating terms in free tagging vocabularies currently works with U+002C but doesn't work with U+FF0C. Users typing in a Chinese language IME have little to no awareness of this and no ability to type the ',' Unicode character U+002C other than exiting the IME.
What are the steps required to reproduce the bug?
Try and separate terms in a free tagging vocabulary with U+FF0C.
What behavior were you expecting?
Terms to be separated.
What happened instead?
Terms were not separated.
Also note:
Lists in Chinese are sometimes separated with ',' U+FF0C and at other times separated by '、' Unicode U+3001 'Ideographic Comma' - depending on the type of list/list context. In a multilingual or Chinese language only site all three forms of comma should be able to separate items in a list.
See http://blog.northclick.de/archives/25 for an approach (and approaching PHP functions which do not treat UTF-8 characters as multiple bytes per character).
Steps to reproduce
- Install Drupal standard profile
- Enable Language and Content Translation
- Go to admin/config/regional/language, add Chinese, Traditional
- Go to admin/config/regional/content-language, Enable translation for Content, Article and Taxonomy Term, Tags
- Go to /node/add/article, add an article.
- Select Chinese as the language
- In the tags field, enter 测试, 测试1
- Save node
- Notice the two tags are saved
- Go to admin/structure/taxonomy/manage/tags/overview. See that 测试 and 测试1 are separate tags.
- Go to /node/add/article, add another article.
- Select Chinese as the language
- In the tags field, enter 测试,测试1,测试2
- Save node
- Notice the three tags are saved as one
- Go to admin/structure/taxonomy/manage/tags/overview. See that 测试2 has not been added as a tag, the entire string 测试,测试1,测试2 has been incorrectly added as a single tag
Proposed resolution
TBA
Remaining tasks
Patch
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | Screenshot 2023-02-13 at 12.11.15.png | 61.74 KB | pandaski |
| #33 | Screenshot 2023-02-13 at 12.11.08.png | 69.63 KB | pandaski |
| #33 | Screenshot 2023-02-13 at 12.11.01.png | 161.26 KB | pandaski |
| #14 | 582534-freetagging-fullwidth-ideographic-commas.patch | 739 bytes | sitiveni |
| #14 | 582534-freetagging-fullwidth-ideographic-commas-D6.patch | 753 bytes | sitiveni |
Comments
Comment #1
mattyoung commentedsub
Comment #2
brianV commentedBumping to D7, and adding patched for both D7 and D6.
Comment #3
brianV commentedOops, forgot to send the 'Unicode' argument.
Err, the d.org server sends the patch files as ISO-8859-1, at least for me. So the , character appears corrupted in the patch file when viewed. See http://drupal.org/node/89349
Comment #4
brianV commentedSince the patches can't be seen correctly when the files are viewed, the changes are pasted below:
D7:
D6:
Comment #10
sitiveni commentedWe were stumbling upon this issue (free tagging taxonomy terms with CJK commas) on our site.
Is there a reason why you didn't include the ideographic comma (U+3001) in the regular expression?
I temporarily made the following change to my core's common function drupal_explode_tags, which seems to work:
$regexp = '%(?:^|,|、|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",|、|,]*))%xu';What is the reason that this issue is slumbering on and the solution isn't incorporated yet (apart from the obvious)?
Comment #11
brianV commentedsitiveni - please feel free to roll a revised patch to handle this.
Comment #12
sitiveni commentedHere we go then with the patches (D7 + D6):
Comment #14
sitiveni commentedOops, haven't encoded the files in UTF-8.
Comment #16
wwwwoicn commentedSubscribe...
Comment #17
xjmMarked #742404: Deal with Chinese commas properly as duplicate of this issue.
Comment #18
rogical commentedcan we back port this to D7?
Comment #19
m.bdwey commentedalso same issuse with arabic
need to use ، not ,
Comment #31
quietone commentedIs this issue still a problem?
There has been no activity here for 7 years suggesting this may be resolved.
If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Since we need more information to move forward with this issue, I am setting at Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #33
pandaski commentedUnfortunately, this issue is still available with Drupal 9.4.* and above.
Steps to reproduce:
1. Install a vanilla Drupal 9.4.* or above.
2. Create a content type and a taxonomy vocabulary - "tags" for example
3. Add a new field "free tags" for example - "Entity reference field" to Step 2 taxonomy vocabulary and Allow the number of values "unlimited"
4. Check "Create referenced entities if they don't already exist"
5. Choose "Autocomplete (Tags style)" in "Manage form display"
6. Type/Copy 测试, 测试1 in the "tag" field then save the node - the tag is separated as expected
7. Type/Copy 测试,测试1,测试2 in the "tag" field then save the node - the tag is not separated
Comment #34
pandaski commentedComment #35
quietone commented@pandaski, thanks for the steps to reproduce.
I have updated the Issue Summary to add the steps to reproduce, starting from a standard install. I used the info provided in #33.
Comment #36
pandaski commentedThere is a change record "drupal_implode_tags() and drupal_explode_tags() replaced with Drupal\Component\Utility\Tags class"
https://www.drupal.org/node/2212099
With function here for Drupal 9 and 10
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Util...
and
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Component%21Util...
$regexp = '%(?:^|,|、|,\ *)("(?>[^"]*)(?>""[^"]* )*"|(?: [^",|、|,]*))%xu'; // From comment 10
The above regex looks still good at testing.
Comment #37
penyaskitoLooking at core\misc\autocomplete.es6.js, if you go to autocompleteSplitValues you'll see a hardcoded ",", so I guess this is still an issue.
Comment #38
quietone commented@penyaskito, thanks for commenting. This was discussed in a bugsmash group triage meeting with Pandaski. catch and myself. catch noted that the replacement for JQuery UI autocomplete should be checked to see if it has the same problem. #3076171: Provide a new library to replace jQuery UI autocomplete. I have updated the other issue.