From cef4a4d7095eae474c0bebaa4b0fb0001f140672 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 22 Apr 2017 15:34:29 +0200 Subject: [PATCH] Fix utf8 problems with iolists. --- lib/pleroma/web/ostatus/ostatus_controller.ex | 1 + test/support/factory.ex | 2 +- test/web/ostatus/feed_representer_test.exs | 2 +- test/web/ostatus/user_representer_test.exs | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index 4db4a55e6..3c8d8c0f1 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -18,6 +18,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do response = FeedRepresenter.to_simple_form(user, activities, [user]) |> :xmerl.export_simple(:xmerl_xml) + |> to_string conn |> put_resp_content_type("application/atom+xml") diff --git a/test/support/factory.ex b/test/support/factory.ex index 401fdfda3..d7c16f0e0 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -3,7 +3,7 @@ defmodule Pleroma.Factory do def user_factory do user = %Pleroma.User{ - name: sequence(:name, &"Test User #{&1}"), + name: sequence(:name, &"Test テスト User #{&1}"), email: sequence(:email, &"user#{&1}@example.com"), nickname: sequence(:nickname, &"nick#{&1}"), password_hash: Comeonin.Pbkdf2.hashpwsalt("test"), diff --git a/test/web/ostatus/feed_representer_test.exs b/test/web/ostatus/feed_representer_test.exs index a5f28f6d5..9a02d8c16 100644 --- a/test/web/ostatus/feed_representer_test.exs +++ b/test/web/ostatus/feed_representer_test.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Web.OStatus.FeedRepresenterTest do most_recent_update = note_activity.updated_at |> NaiveDateTime.to_iso8601 - res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> IO.iodata_to_binary + res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> to_string user_xml = UserRepresenter.to_simple_form(user) |> :xmerl.export_simple_content(:xmerl_xml) diff --git a/test/web/ostatus/user_representer_test.exs b/test/web/ostatus/user_representer_test.exs index 80ac8181a..a4afc2cf7 100644 --- a/test/web/ostatus/user_representer_test.exs +++ b/test/web/ostatus/user_representer_test.exs @@ -6,10 +6,10 @@ defmodule Pleroma.Web.OStatus.UserRepresenterTest do alias Pleroma.User test "returns a user with id, uri, name and link" do - user = build(:user) + user = build(:user, nickname: "レイン") tuple = UserRepresenter.to_simple_form(user) - res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> IO.iodata_to_binary + res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> to_string expected = """ #{user.ap_id} -- 2.45.2