1

I'm using RESTful web services and Node.js to export a Mongo database into Drupal. This is working fine, however I get the occasional 500 or 406 error. I've narrowed it down to a "£" sign. In node I'm doing an http request using the below. All this works fine apart from the £ sign. Do I have to do a character replace for each string or something?

...
var req = http.request(options, function(res) {
    res.setEncoding('utf-8');
    ...

This is the JSON:

{ 
    "type": 'primary_whatson',
    "field_parent_article": { 
        "uri": 'http://tp/cms/node/702', 
        "id": '702', 
        "resource": 'node' },
        "field_whatson_theme": { 
            "uri": 'http://tp/cms/taxonomy/term/385',
        "id": '385',
        "resource": 'taxonomy_term' 
    },
    "title": 'Test',
    "field_body": { 
        "value": '<p>test.</p>',
        "summary": '',
        "format": 'filtered_html' 
    },
    "field_ticket_price_v": "Tickets free-£9.00"
}
2
  • Is it Drupal to throw 500 or 406, or the other side? Also, "406 Not Acceptable" seems pretty self-explanatory. Are you sure both sides can treat the £ the same way? And that both are really utf-8? And that both in fact can use utf-8? Maybe one of your sides, or some proxy, can't, and £ prevents ASCII fallback? Just guessing now.
    – Mołot
    Jul 24, 2014 at 15:28
  • It is Drupal, via the RESTful module. The error does not give me anything helpful. A 406 would be self explanatory, but referring back to my question where a "£" exists in the JSON file, I get either a 406 or a 500. It is UTF-8 on both sides yes. Yeah I'm guessing too. I'm just running it locally so no proxy issue. I will keep digging. Thanks for taking a look dude Jul 24, 2014 at 20:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.