A node reference is created for content with a title 'Rōm...' programmatically, however attempting to save the node through the Drupal admin interface causes the following error: "...title mismatch. Please check your selection."

Comments

joelrichard’s picture

Issue summary: View changes

I'm very surprised that this hasn't received any comments in three years. Since this is a huge problem for me and my body of data, I'm going to debug it and paste a patch here.

Initial investigation reveals that the problem is occurring on or around line 672 of node_reference/node_reference.module:

 if (trim($title) != trim($real_title)) {

Using strcmp() also products the same, incorrect result.

A visual check of those values shows they are they same, but for whatever reason, even though both of my strings are UTF-8, they are coming up as different. An acute accented french e (é in HTML entity terms) gives me two different results when I look at the bytes. In the case of the $title field, I have two bytes (values 195 and 169 which are LATIN SMALL LETTER E WITH ACUTE). In the case of the $real_title, I get three bytes (101, 204, 129). The101 is the "e" and the 204 and 129 are "COMBINING ACUTE ACCENT". So these are encoded very differently somehow.

Even using mb_convert_encoding() or iconv() I still get different results. This is very strange to me. :) I will keep investigating as I can.

joelrichard’s picture

Issue summary: View changes

Another source of my particular issues may be with where the data is coming from. I.e. it was imported. But then the browser may be doing strange things to do the data when it's being displayed in the text boxes for the node reference.

This has just gotten more complicated. :)

Also, even if I use iconv('UTF-8','ASCII//TRANSLIT',$title) I still get different results. Frustrating.