Fix utf8 problems with iolists.

This commit is contained in:
Roger Braun 2017-04-22 15:34:29 +02:00
parent 04fb4f9c47
commit cef4a4d709
4 changed files with 5 additions and 4 deletions

View file

@ -18,6 +18,7 @@ def feed(conn, %{"nickname" => nickname}) do
response = FeedRepresenter.to_simple_form(user, activities, [user])
|> :xmerl.export_simple(:xmerl_xml)
|> to_string
conn
|> put_resp_content_type("application/atom+xml")

View 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"),

View file

@ -14,7 +14,7 @@ test "returns a feed of the last 20 items of the user" 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)

View 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>