Skip to content

bug: Exported PDF is corrupted/broken for Japanese/multi-byte characters #1163

Description

@Takashi-Mishima

// ui/components/ChatWindow.tsx PDF download function in
const handleDownloadPDF = async () => {
const response = await fetch(${API_URL}/chats/${chatId}/export/pdf);
const data = await response.text(); // ❌ It has been loaded as text (the data is corrupted here)
const blob = new Blob([data], { type: 'application/pdf' });

// 以下、ファイル保存処理...
};

// ui/components/ChatWindow.tsx PDF download function in
const handleDownloadPDF = async () => {
const response = await fetch(${API_URL}/chats/${chatId}/export/pdf);
const blob = await response.blob(); // ⭕ Receive directly as a binary using blob()

const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = chat-${chatId}.pdf;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions