Formatting Issues with CapCut Template Data Exported to LibreOffice Calc

Hi everyone,

I manage a website where users can upload and share CapCut templates. To help organize and analyze these templates, I allow users to export their template data (title, duration, effects used, etc.) as a .csv file, which they can open in LibreOffice Calc. However, I’m running into some formatting and compatibility issues when users try to open the exported files.

Problems I’m Facing:

  1. Encoding Issues (Special Characters Not Displaying Properly):
  • Some CapCut template names include special characters (e.g., Chinese, Arabic, or emoji), but when opened in LibreOffice Calc, these characters appear as ??? or garbled text. I’m exporting the CSV file using UTF-8 encoding, but LibreOffice doesn’t always detect it correctly. Is there a way to force LibreOffice to recognize UTF-8 automatically?
  1. Line Breaks Causing Row Misalignment:
  • Some template descriptions contain line breaks, and when users open the CSV in LibreOffice, it sometimes splits the content into multiple rows instead of keeping it within a single cell. I’m using proper CSV escaping (" around values), but the issue persists. Is there a better way to handle this when exporting CSV files?
  1. Numbers Auto-Formatted Incorrectly:
  • CapCut templates have duration values stored in hh:mm:ss format, but LibreOffice Calc sometimes converts them into random numbers or date formats. How can I ensure that these values stay in text format when opened?
  1. Formula Injection Risk in CSV Files:
  • Since users upload their own templates, some fields might contain formulas (e.g., =SUM(A1:A10)). I want to prevent LibreOffice from treating these as executable formulas for security reasons. Is there a best practice for escaping these fields so they are displayed as plain text?

What I’ve Tried:

  • Set Content-Type to text/csv; charset=UTF-8 in my website’s export function.
  • Wrapped text fields in double quotes and used \n for line breaks.
  • Manually setting column types to “Text” in LibreOffice, but users want an automatic solution.
  • Prefixed formulas with a single quote (') to prevent execution, but unsure if this is the best approach.

Has anyone encountered similar CSV formatting issues with LibreOffice Calc? Any suggestions on how I can improve the export compatibility for my CapCut template data?

Thanks in advance!

One sample problematic file is better than a thousand words (well, the words are also good, but useless without a sample). How can I see the “doesn’t always detect”? A guess is - either you use an old LibreOffice, or the non-ASCII appears really far from start of file… How can I see a “proper CSV escaping” and at the same time “splits the content into multiple rows” without a sample? You see the pattern :wink:

And the “formula injection” piece reinforces the “ole LibreOffice” suspicion - the option to not import formulas appeared in 7.3 (tdf#114878)