JMeter-在HTTP POST请求中模拟带重音的UTF8字符 [英] JMeter - Simulate accented UTF8 characters in http POST request

查看:194
本文介绍了JMeter-在HTTP POST请求中模拟带重音的UTF8字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache JMeter 2.8在一个基于Web的信息系统上进行一些性能测试.

I'm using Apache JMeter 2.8 to carry out some performance testing on one web-based information system.

在不同的请求中使用了几个重音字母-例如ä",ö",ü"或õ".

There are several accented letters used in different requests - like 'ä', 'ö', 'ü' or 'õ'.

当涉及到运行测试脚本和执行请求时,例如某些参数中的ä"值将变为Ã". ('-'-这是jmeter将此类字符保存到* .jmx文件的方式.)这些http请求的内容编码设置为UTF-8.当我查看项目的内容时,所有字符都会正确显示.当我运行测试脚本时,使用了错误的值.

When it comes to running test scripts and executing requests, for example 'ä' value in some parameter turns into 'ä'. ('ä' - This is the way jmeter saves such character into a *.jmx file) Content encoding for these http requests is set to UTF-8. When i look at the contents of the project, all characters are displayed correcly. When i run test scripts wrong values are used.

稍后添加: 我可以使用utf8字符成功模拟GET请求,但POST请求中的重音字符仍然看起来像¤".是什么原因,为什么jmeter的GET请求数据具有正确的utf8编码,而改为使用Windows-1252/ISO-8859-1/cp1252/"ANSI" POST?

Added later: I can successfully simulate GET requests with utf8 chars, but still accented characters in my POST requests look like 'ä'. What can be the reason, why jmeter's GET requests' data has proper utf8 encoding and POSTs Windows-1252/ISO-8859-1/cp1252/"ANSI" instead?

为什么会发生这种情况?预先感谢!

Any ideas why this happens? Thanks in advance!

推荐答案

JMeter在JMX中正确保存了字符,请确保使用正确的编码(UTF-8)打开它们.

JMeter saves character correctly in JMX, ensure that you opened them with the right encoding (UTF-8).

在JMeter中具有此属性:

In JMeter there is this property:

  • sampleresult.default.encoding = ISO-8859-1

,如果这不是默认编码,则可以更改.但是我不确定这是您面临的问题.

which you can change if this is not the default encoding. But I am not sure it's the issue you are facing.

检查编码?"

解决方案是:

  • 将内容编码设置为UTF-8

  • set content encoding to UTF-8

在参数表中检查编码?,因为您的参数不是ascii参数

Check Encode? in parameters table as your parameters are non ascii ones

如果这不起作用,则表明在经过测试的应用程序上存在问题:

if this does not work, it reveals an issue on tested application:

request.setCharacterEncoding("UTF-8") must be called before using parameters if it's a Java Application.

PHP和ASP存在相同的概念.

Same concepts exist for PHP and ASP.

这篇关于JMeter-在HTTP POST请求中模拟带重音的UTF8字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆