Search Results

Search found 1 results on 1 pages for 'user1475154'.

Page 1/1 | 1 

  • Convert matched string of UTF-8 values to UTF-8 characters in Ruby

    - by user1475154
    Trying to convert output from a rest_client GET to the characters that are represented with escape sequences. Input: ..."sub_id":"\u0d9c\u8138\u8134\u3f30\u8139\u2b71"... (which I put in 'all_subs') Match: m = /sub_id\"\:\"([^\"]+)\"/.match(all_subs.to_str) [1] Print: puts m.force_encoding("UTF-8").unpack('U*').pack('U*') But it just comes out the same way I put it in. ie, "\u0d9c\u8138\u8134\u3f30\u8139\u2b71" However, if I convert a raw string of it: puts "\u0d9c\u8138\u8134\u3f30\u8139\u2b71".unpack('U*').pack('U*') The output is perfect as "??????"

    Read the article

1