Fix utf8 problems with iolists.
authorRoger Braun <roger@rogerbraun.net>
Sat, 22 Apr 2017 13:34:29 +0000 (15:34 +0200)
committerRoger Braun <roger@rogerbraun.net>
Sat, 22 Apr 2017 13:34:29 +0000 (15:34 +0200)
lib/pleroma/web/ostatus/ostatus_controller.ex
test/support/factory.ex
test/web/ostatus/feed_representer_test.exs
test/web/ostatus/user_representer_test.exs

index 4db4a55e651f9550fc03c536aaaa6e4cb4a99c2d..3c8d8c0f11e665c60366435620bb3573cb98d499 100644 (file)
@@ -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")
index 401fdfda3d725320b2c5ac16ec7bc4f781380c0f..d7c16f0e0997edd92e609a4bdf00032064ef1d21 100644 (file)
@@ -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"),
index a5f28f6d5cd54d356c4860ae2bf945c782a7af60..9a02d8c16cae22ca3be501aa824fdf14ddc9416a 100644 (file)
@@ -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)
 
index 80ac8181ad5ebffc16ef36857a328b71ad72fadc..a4afc2cf78efbb0badb543f2bb249167fac4c165 100644 (file)
@@ -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 = """
     <id>#{user.ap_id}</id>