Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

themenace's avatar

How to display unescaped data ?

Looking for a way to display data unescaped, something like TextColumn::make('Data') ->raw()

For example, a user has added some Chinese Characters to a Supplier name but what I get is the html codes when displayed in filament 3 "Jinyun Hero Import and Export Co. Ltd 缙云恒利进出口&#2637"

0 likes
2 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

To display unescaped data in Filament, you can use the html() method on the TextColumn to render the data as HTML instead of escaping it. This is particularly useful when you are sure that the data does not contain any harmful scripts or elements that could lead to XSS (Cross-Site Scripting) vulnerabilities. Here's how you can modify your TextColumn to display unescaped data:

TextColumn::make('Data')
    ->html()

This will tell Filament to treat the content of the 'Data' column as HTML, which means it will render Chinese characters and other HTML entities properly without converting them to their respective HTML codes.

Always ensure that the data you are marking as HTML is safe to render to prevent security risks. If the data comes from user input, consider sanitizing it before displaying.

themenace's avatar

and just to clarify, I posted the html codes in my post, however, they appear correctly as chinese characters in this forum. When I turn on the Markdown Preview, I can see the correct thing. I put some spaces in the html codes so they would not be interpreted. & # 32537 ; & # 20113

Please or to participate in this conversation.