Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

bug encoding multipart form post #38

Merged
merged 1 commit into from

2 participants

@ftaiolivista

Forms with enctype="multipart/form-data" not correctly interpret unicode when using init param
unicode: true

@Kdecherf
Owner

Hi,

Unicode is really buggy in Quercus and need a global refactoring.
We are working hard to add this full support in our team but the changes aren't released yet.

Can you give me an example to illustrate this issue ?

@ftaiolivista

Init param => unicode: true

Try inserting some utf8 text inside the textbox ( for example 一个日志文件执) and push "Display"

In case of a normal form the $_POST argument is correctly returned and displayed as UTF8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>   
    <head>
        <title>Test</title>
    </head>
    <body>
        <h1><?php echo "returned from form " . $_POST['test']; ?></h1>
        <form method="POST" action="clever.php" >
            <input type="text" name="test" value="" /><input type="submit" value="Display" />    
        </form>
    </body>
</html>

In case of a multipart/form-data form the $_POST argument is displayed in a bad way

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>   
    <head>
        <title>Test</title>
    </head>
    <body>
        <h1><?php echo "returned from form " . $_POST['test']; ?></h1>
        <form method="POST" action="clever.php"  enctype="multipart/form-data" >
            <input type="text" name="test" value="" /><input type="submit" value="Display" />        
        </form>
    </body>
</html>

Our modification of the Quercus Post class solve this problem I think.

@Kdecherf
Owner

Non-reproducible issue on our internal version of Quercus (will be released on GitHub in next weeks), so already fixed ;)
But I merge your pull request on this repo.

If you want more informations, please send me an email (kdecherf at gmail.com).

@Kdecherf Kdecherf merged commit d60c80f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 6, 2011
  1. @ftaiolivista
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  quercus/src/main/java/com/caucho/quercus/env/Post.java
View
2  quercus/src/main/java/com/caucho/quercus/env/Post.java
@@ -213,7 +213,7 @@ private static void readMultipartStream(Env env,
if (bracketIndex >= 0 && bracketIndex < name.length() - 1) {
// php/085c
} else if (filename == null) {
- StringValue value = env.createStringBuilder();
+ StringValue value = env.createBinaryBuilder();
value.appendReadAll(is, Integer.MAX_VALUE);
Something went wrong with that request. Please try again.