When I'm trying to put metadata (title, description) in Russian I'm getting them back as a garbage.
Here is what I see in the ftitle field of the news_webfm_file table: '%D0%BA%D1%83-%D0%BA%D1%83'

Thank you.

Comments

robmilne’s picture

Status: Active » Closed (works as designed)

The metadata in the webfm_file table is 'escaped' via the javascript encodeURIComponent() function. WebFM decodes the metadata via the javascript unescape() function. The php function to decode is urldecode - see the webfm_fdesc() class in webfm.module.

Sensor’s picture

Nothing wrong with storing data in the escaped form (however little bit strange since the Russian filename saved in raw utf8).
The problem is that I'm getting garbage in the metadata edit form...
I.e. I enter title in Russian, Submit it, close the metadata edit form, then open it again, and see garbage in the title field. I've test this in both FF and IE.
I saw that same issue appeared in previous versions, but promised to fixed in 2.5 - http://drupal.org/node/210199.

Thank you.

Sensor’s picture

-I know kung-fu! (c) Neo@Matrix :)

In the js/webfm.js in the HEAD on lines 2268 and 2277

2268          elTextArea.value = unescape(this.data[i]);
          elTd.appendChild(elTextArea);
          break;
        default:
          // textfield
          var elInput = Webfm.ce('input');
          elInput.setAttribute('type', 'textfield');
          elInput.setAttribute('name', i);
          elInput.setAttribute('size', '40');
2277   elInput.setAttribute('value', unescape(this.data[i]));
          elTd.appendChild(elInput);

You are using the unescape function which is not utf friendly according to the documentation. unescape function does not take four digits hexadecimal entities %XXXX, but takes only two digits.

Changing unescape to decodeURI fixes the issue.

robmilne’s picture

Thanks for that. I'll commit this change to head immediately.

robmilne’s picture

Status: Closed (works as designed) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.