multipart/form-data with charset=UTF-8 causes file upload to fail in Lucee 7.0.0.202

OS: Windows Server 2022
Java Version: OpenJDK 21
Tomcat Version : 11.0.6
Lucee Version : 7.0.0.202


Hello everyone,

I’m encountering an issue with multipart/form-data encoding in Lucee 7.0.0.202.

Problem Description:

When using a file upload form, if I specify:

the file uploads successfully, but Turkish characters (such as “ş, ü, ğ, ı”) in text fields are corrupted.

To fix the character encoding issue, I updated the form to:

With this change, Turkish characters are correctly preserved — but file uploads stop working. The uploaded file fields seem empty or invalid on the server side.

Summary:

  • multipart/form-data → file upload OK, text broken :x:
  • multipart/form-data;charset=UTF-8 → text OK :white_check_mark:, file upload broken :x:

Question:

Is there a recommended way to properly support both:

  • UTF-8 encoded text fields,
  • and successful file uploadsin Lucee 7 (without manual low-level parsing)?

Or is this a known issue that may require a fix or workaround?

Tomcat is doing this

If you set enctype="multipart/form-data;charset=UTF-8" in your form, Tomcat 6 converts this to: content type: application/x-www-form-urlencoded , which is the problem.

let me see what I can do

I’ve re-opened your previous ticket

https://luceeserver.atlassian.net/browse/LDEV-5545

If you’re using Tomcat, check your web.xml for the following lines:

  <!-- Set the default request and response character encodings to UTF-8.   -->
  <request-character-encoding>UTF-8</request-character-encoding>
  <response-character-encoding>UTF-8</response-character-encoding>

By default, Tomcat 11 has them as the first lines “Introduction” section:

  <!-- ======================== Introduction ============================== -->
  <!-- This document defines default values for *all* web applications      -->
  <!-- loaded into this instance of Tomcat.  As each application is         -->
  <!-- deployed, this file is processed, followed by the                    -->
  <!-- "/WEB-INF/web.xml" deployment descriptor from your own               -->
  <!-- applications.                                                        -->
  <!--                                                                      -->
  <!-- WARNING:  Do not configure application-specific resources here!      -->
  <!-- They should go in the "/WEB-INF/web.xml" file in your application.   -->

I’m not sure if that’s the root cause, but it’s worth testing.

I tested this locally with 7 and it solved the problem, the Lucee docker images already have this config

The next express versions and installers published will all include these changes

https://luceeserver.atlassian.net/browse/LDEV-5563