Help us understand the problem. What is going on with this article?

Power BIでCognitive APIを使用して日本語を分析する方法(文字化け対策)

More than 3 years have passed since last update.

ハマったところ

英語を分析する場合このページの通りにすればOK。しかし日本語を分析しようとするとCognitive Serviceから返ってくる文字が文字化けしているので、少し変える必要がある。

変えるところ

Cognitive Serviceを呼び出すクエリ

(Source) =>
let
    JsonRecords = Text.FromBinary(Json.FromValue(Source)),
    JsonRequest = "{""documents"": " & JsonRecords & "}",

    JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Ascii),
    Response =
        Web.Contents("https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases?",
            [
                Headers = [#"Ocp-Apim-Subscription-Key"= APIKey,
                           #"Content-Type"="application/json", Accept="application/json"],
                Content=JsonContent
            ]),
    JsonResponse = Json.Document(Response,1252)
in
    JsonResponse

の中の

JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Ascii),

JsonResponse = Json.Document(Response,1252)

の2ヶ所を

JsonContent = Text.ToBinary(JsonRequest, TextEncoding.Utf8),

JsonResponse = Json.Document(Response,TextEncoding.Utf8)

のように変えるといけた。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away