# Bug OP-19407 - Inline text attachments lose UTF-8 charset

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-19407

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Attachments |
| Target versions | 17.6.0 |
| Observed in versions |  |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Oliver Günther |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

## Environment

OpenProject `17.4` with attachments on S3 storage.

## Steps to reproduce

1.  Upload a UTF-8 text file containing non-ASCII characters with accented characters) to a WP : `.md`, `.txt` or `.js`.
    
2.  Open the attachment inline, in the browser.
    

## Expected

The text is displayed with correct UTF-8 :  
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921417/content">

## Current

Non-ASCII characters render incorrectly :  
<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/921418/content">

## Workaround

Right click + downloading the file and opening locally still works fine with valid UTF-8.

## Notes

Binary attachments like `.odt` are unaffected since they are served as a download by default rather than rendered inline.

The served Content-Type is text/plain without a charset, so the browser falls back to legacy encoding. For S3-backed attachments the presigned URL sets response-content-disposition but not response-content-type, so S3 returns the stored content type without a charset.
