2

I'm scraping websites and need to decode javascript escape sequences to standard unicode strings. For example, the source file contains the sequence:

\u30ca\u30c1\u30e5\u30e9\u30eb\u30ed\u30fc\u30bd\u30f3\u3000\u7bc9\u5730\u6771\u5287\u30d3\u30eb 

and I want to convert it to the string

ナチュラルローソン築地東劇ビ

How can I do this?

J...
  • 30,968
  • 6
  • 66
  • 143
The Rock
  • 69
  • 8
  • 1
    I don't understand. You want to use notation like `\u30c1` in Delphi code? If so, replace `\u` by `#$`. – Victoria Aug 15 '17 at 08:41
  • What are you looking for? A string literal? And which version of Delphi? Presumably a version that supports Unicode, i.e. 2009 or later. – David Heffernan Aug 15 '17 at 08:44
  • I want to get japan character like this (ナチュラルローソン築地東劇ビ) but those character show like (\u30ca\u30c1\u30e5\u30e9\u30eb\u30ed\u30fc\u30bd\u30f3\u3000\u7bc9\u5730\u6771\u5287\u30d3\u30eb), how can I get it with pacal? cause now I wrote code with pascal. – The Rock Aug 15 '17 at 08:58
  • I want to convert this code '\u30ca\u30c1\u30e5\u30e9\u30eb\u30ed\u30fc\u30bd\u30f3\u300‌​0\u7bc9\u5730\u6771\‌​u5287\u30d3\u30eb' to Japanese character. – The Rock Aug 15 '17 at 09:03
  • You are repeating yourself. We didn't understand the first time you said this, and it wasn't because we didn't try. It doesn't matter how many times you say the same thing. Please read our comments and address **all** the points raised. – David Heffernan Aug 15 '17 at 09:17
  • - I'm looking for japanese character as the result from the code above. Ex. ツ = \u30C4(http://graphemica.com/%E3%83%84) - I'm using XE2 – The Rock Aug 15 '17 at 09:26
  • Yeah, I am screen scraping. – The Rock Aug 15 '17 at 09:28
  • sorry about that. – The Rock Aug 15 '17 at 09:34
  • I deleted my answer, because the edit to the question somewhat changed the focus and made my answer invalid. This is why it matters to ask the right question from the start. Please take more time when asking to make it 100% clear what you are asking. – David Heffernan Aug 15 '17 at 10:08
  • @J... Nope, I used mine already, then retracted it, so we need another hammer – David Heffernan Aug 15 '17 at 13:14
  • I think if you look on meta, the consensus is that once a post is closed for the wrong reason, it is better to leave it that way, rather than reopening and then reclosing. – David Heffernan Aug 15 '17 at 13:20
  • I have a parser for these. If no one will post here, I can do in hours (it's simple, but have no time). I'm not aware of any function to do that. – Victoria Aug 15 '17 at 13:47
  • @Victoria See : https://stackoverflow.com/a/9714023/327083 – J... Aug 15 '17 at 13:54
  • @Victoria, it should closed as a dupe to the above link. Unfortunately we ran out of dupe-hammers on this question. Feel free to vote though. – LU RD Aug 15 '17 at 14:06
  • @LURD, I don't know what it means, but do what you need :) – Victoria Aug 15 '17 at 14:11
  • @Victoria, rob helped us with his dupe-hammer. It's fine now. – LU RD Aug 15 '17 at 14:12

0 Answers0