在Python中,我想执行+
。我的参数中有一个base64字符串。除了%2B
字符已转换为/
而%2F
个字符已转换为%
。 Web服务器将base64字符串解码为文本,并在提供响应之前与其一起运行。以下示例,如果有帮助的话。
当我到达base64字符串中的第一个百分号时,我发现base64反向转换在服务器上中断了。 (在下面的示例输出中,损坏开始的点就在第一个%
符号在base64字符串中的位置。)
现在,我不认为服务器的base64转换有任何问题,因为我可以手动将网址输入到网页浏览器及其参数中,并且所有内容都会恢复正常。 (实际上,here就是那个url。结果对你来说可能看起来很垃圾,但如果你要与下面的垃圾进行比较,请查看页面源代码。)所以我认为它的Python是不按照我喜欢的方式处理%
。
如何让Python正确处理这些%%
个字符?我尝试使用response = session.get('https://webwork/webwork2/html2xml', params={'outputformat': 'simple', 'problemSource': 'IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMjIyBHZW5lcmF0ZWQgZnJvbSBNYXRoQm9vayBYTUwgc291cmNlIAojIyMgICAgb24gMjAxNS0xMC0yNlQxNTo1MDo0OS0wNzowMCAgICAKIyMjICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiMjIyAgIGh0dHA6Ly9tYXRoYm9vay5wdWdldHNvdW5kLmVkdSAgIAojIyMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMjIERCc3ViamVjdCgpCiMjIERCY2hhcHRlcigpCiMjIERCc2VjdGlvbigpCiMjIExldmVsKCkKIyMgS0VZV09SRFMoKQojIyBUaXRsZVRleHQxKEludGVncmF0aW5nIFdlQldvcksgaW50byBUZXh0Ym9va3MpCiMjIEVkaXRpb25UZXh0MSgpCiMjIEF1dGhvclRleHQxKFJvYmVydCBCZWV6ZXIsIEFsZXggSm9yZGFuKQojIyBTZWN0aW9uMSg4LikKIyMgUHJvYmxlbTEoMSkKIyMgQXV0aG9yKCkKIyMgSW5zdGl0dXR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IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMgU29sdXRpb24KIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCkJFR0lOX1BHTUxfU09MVVRJT04KVGhlIGdyYXBoIHJldmVhbHMgdGhhdCB0aGUgb25seSBzb2x1dGlvbiB0byBbYGYoeCk9MWBdIGlzIFtgeD1bJGFuc3dlcl1gXS4KCj4%2BIFtAIGltYWdlKGluc2VydEdyYXBoKCRzb2xnciksIHdpZHRoPT40MDAsIGhlaWdodD0%2BNDAwLCB0ZXhfc2l6ZT0%2BODAwLCBleHRyYV9odG1sX3RhZ3M9PnFxIWFsdD0iIiEpQF0qIDw8CgoKRU5EX1BHTUxfU09MVVRJT04KCiMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwojIEVuZCBQcm9ibGVtCiMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwpFTkRET0NVTUVOVCgpOwo=', 'courseID': 'anonymous', 'userID': 'anonymous', 'displayMode': 'tex', 'problemSeed': '123567890', 'password': 'anonymous', 'answersSubmitted': '0'}, verify=False)
并且没有帮助。
这是一个实时MWE,因此它有一个非常长的base64字符串。
response.text
然后当我看%
时,我看到以下内容。你可以忽略所有的html包装器。正在进行反向翻译的文本会在第50行的计算行数的地方分解,而且我发现这正是第一个<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/webwork2_files/images/favicon.ico"/>
<!-- CSS Loads -->
<link rel="stylesheet" type="text/css" href="/webwork2_files/js/vendor/bootstrap/css/bootstrap.css"/>
<link href="/webwork2_files/js/vendor/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="/webwork2_files/css/jquery-ui-1.8.18.custom.css"/>
<link rel="stylesheet" type="text/css" href="/webwork2_files/css/vendor/font-awesome/css/font-awesome.min.css"/>
<link rel="stylesheet" type="text/css" href="/webwork2_files/themes/math4/math4.css"/>
<link href="/webwork2_files/css/knowlstyle.css" rel="stylesheet" type="text/css" />
<!-- JS Loads -->
<script type="text/javascript" src="/webwork2_files/js/vendor/jquery/jquery.js"></script>
<script type="text/javascript" src="/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>
<script type="text/javascript" src="/webwork2_files/js/jquery-ui-1.9.0.js"></script>
<script type="text/javascript" src="/webwork2_files/js/vendor/bootstrap/js/bootstrap.js"></script>
<script src="/webwork2_files/js/apps/AddOnLoad/addOnLoadEvent.js" type="text/javascript"></script>
<script src="/webwork2_files/js/legacy/java_init.js" type="tesxt/javascript"></script>
<script src="/webwork2_files/js/apps/InputColor/color.js" type="text/javascript"></script>
<script src="/webwork2_files/js/apps/Base64/Base64.js" type="text/javascript"></script>
<script src="/webwork2_files/mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML-full" type="text/javascript"></script>
<script type="textx/javascript" src="/webwork2_files/js/vendor/underscore/underscore.js"></script>
<script type="text/javascript" src="/webwork2_files/js/legacy/vendor/knowl.js"></script>
<script src="/webwork2_files/js/apps/Problem/problem.js" type="text/javascript"></script>
<script type="text/javascript" src="/webwork2_files/themes/math4/math4.js"></script>
<script type="text/javascript" src="/webwork2_files/js/vendor/iframe-resizer/js/iframeResizer.contentWindow.min.js"></script>
<base href="https://webwork.pcc.edu/mod_xmlrpc">
<title>https://webwork.pcc.edu/mod_xmlrpc WeBWorK Editor using host: https://webwork.pcc.edu/mod_xmlrpc, format: simple seed: 123567890</title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12 problem">
<form action="https://webwork.pcc.edu/webwork2/html2xml" method="post">
<div class="problem-content">
<A NAME="problem13"><pre> Problem13
1. ERROR caught by Translator while processing problem file:WebworkClient.pm:: define fileName in environment
****************
ERRORS from evaluating PG file: <br/> Unrecognized character \x05; marked by <-- HERE after 5],
size=6<-- HERE near column 562 at line 50 of (eval 1135)
<br/>
****************<br/>
------Input Read
1 #######################################
2 ### Generated from MathBook XML source
3 ### on 2015-10-26T15:50:49-07:00
4 ###
5 ### http://mathbook.pugetsound.edu
6 ###
7 #######################################
8 ## DBsubject()
9 ## DBchapter()
10 ## DBsection()
11 ## Level()
12 ## KEYWORDS()
13 ## TitleText1(Integrating WeBWorK into Textbooks)
14 ## EditionText1()
15 ## AuthorText1(Robert Beezer, Alex Jordan)
16 ## Section1(8.)
17 ## Problem1(1)
18 ## Author()
19 ## Institution()
20 ## Language(en-US)
21
22 DOCUMENT();
23
24 ############################################################
25 # Load Macros
26 ############################################################
27 loadMacros(
28 "PGstandard.pl",
29 "MathObjects.pl",
30 "PGML.pl",
31 "AnswerFormatHelp.pl",
32 "PGgraphmacros.pl",
33 "PGcourse.pl",
34 );
35
36 ############################################################
37 # Header
38 ############################################################
39 COMMENT('Authored in MathBook XML');
40 TEXT(beginproblem());
41
42 ############################################################
43 # PG Setup
44 ############################################################
45 Context('Numeric');
46 $answer = random(1,3,1);
47 $gr = init_graph(-1,-1,4,4,
48 axes=>[0,0],
49 grid=>[5,5],
50 size=6l�������t(��)���}�չ�ѥ��̠��Ȱ���x̼����ݕ�x́��ȁ�����İ����ͥ��������鉱Ք�����ݕ�����Ȉ��(�͕����}��I��������ݕȨȨ��ļ̤��((�ͽ��Ȁ��}�Ʌ����İ�İаа)�����l���t�)�ɥ����R�U���6��S��C�CТ���FE�gV�7F���2�G6��w"�'��2�F�7vW%�2f�"������C`H\�[������H[�ZY����N��܋M�moveTo(0,1);
51 $solgr-6����Q������ݕȰİ��������̤�(�ͽ��ȴ���ɽ�Q������ݕȰ����������̤�((������������������������������������������������������������(�� ���(������������������������������������������������������������) %9}A50)Q����Ʌ�������܁�́���Ʌ������m�����ुt��U͔�ѡ���Ʌ���Ѽ�ͽ�ٔ�ѡ����Յѥ���m�����Łt�((�����vR���6W'Dw&��Fw"��v�GF��`M
ZY�O�
^��^�OO�
^�W����O�\HX[H��JPJ������XH������^�[���\�H�[���\��ܛX][
52 [X�\���PJ����S���S����������������������������������������������������������������][ۂ�������������������������������������������������������������Q�S���S���USӂ�Hܘ�]�X[�Hۛ��][ۈ���
3 OLXH\��V�[���\�XK����� [@ image(insertGraph($solgr), width=>400, height=6�����ѕ�}ͥ�����W�G&��F���Fw3���C�""�Ң�����T�E�t���4��UD��ࠢ222222222222222222222222222222222222222222222222222222222220�2V�B&�&�VТ222222222222222222222222222222222222222222222222222222222220�T�DD�5T�T�B���
-----<br/></pre>
</div>
<input type="hidden" name="answersSubmitted" value="1">
<input type="hidden" name="sourceFilePath" value = "">
<input type="hidden" name="problemSource" value="IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMjIyBHZW5lcmF0ZWQgZnJvbSBNYXRoQm9vayBYTUwgc291cmNlIAojIyMgICAgb24gMjAxNS0xMC0yNlQxNTo1MDo0OS0wNzowMCAgICAKIyMjICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiMjIyAgIGh0dHA6Ly9tYXRoYm9vay5wdWdldHNvdW5kLmVkdSAgIAojIyMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMjIERCc3ViamVjdCgpCiMjIERCY2hhcHRlcigpCiMjIERCc2VjdGlvbigpCiMjIExldmVsKCkKIyMgS0VZV09SRFMoKQojIyBUaXRsZVRleHQxKEludGVncmF0aW5nIFdlQldvcksgaW50byBUZXh0Ym9va3MpCiMjIEVkaXRpb25UZXh0MSgpCiMjIEF1dGhvclRleHQxKFJvYmVydCBCZWV6ZXIsIEFsZXggSm9yZGFuKQojIyBTZWN0aW9uMSg4LikKIyMgUHJvYmxlbTEoMSkKIyMgQXV0aG9yKCkK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yMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCiMgU29sdXRpb24KIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjCkJFR0lOX1BHTUxfU09MVVRJT04KVGhlIGdyYXBoIHJldmVhbHMgdGhhdCB0aGUgb25seSBzb2x1dGlvbiB0byBbYGYoeCk9MWBdIGlzIFtgeD1bJGFuc3dlcl1gXS4KCj4%2BIFtAIGltYWdlKGluc2VydEdyYXBoKCRzb2xnciksIHdpZHRoPT40MDAsIGhlaWdodD0%2BNDAwLCB0ZXhfc2l6ZT0%2BODAwLCBleHRyYV9odG1sX3RhZ3M9PnFxIWFsdD0iIiEpQF0qIDw8CgoKRU5EX1BHTUxfU09MVVRJT04KCiMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwojIEVuZCBQcm9ibGVtCiMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwpFTkRET0NVTUVOVCgpOwo=">
<input type="hidden" name="problemSeed" value="123567890">
<input type="hidden" name="pathToProblemFile" value="">
<input type="hidden" name=courseName value="anonymous">
<input type="hidden" name=courseID value="anonymous">
<input type="hidden" name="userID" value="anonymous">
<input type="hidden" name="password" value="anonymous">
<input type="hidden" name="passwd" value="anonymous">
<input type="hidden" name="displayMode" value="tex">
<input type="hidden" name="session_key" value="Y8EvKT3YOawEPFVA7XH3MepsK63uAkED">
<input type="hidden" name="outputformat" value="simple">
<p>
<input type="submit" name="WWcheck" value="Check answer(s)"/>
<input type="submit" name="WWgrade" value="Show correct answer(s)"/>
</p>
</form>
</div>
</div></div>
</body>
</html>
符号在原始base64字符串中的位置。
input
使问题复杂化,你可以在HTML using System;
using System.Web.Mvc;
namespace MyApp.Classes
{
public static class ViewEngineCollectionExtensions
{
public static string FindViewPath(this ViewEngineCollection viewEngines, ControllerContext controllerContext, string viewName, string masterName = null)
{
var viewResult = ViewEngines.Engines.FindView(controllerContext, viewName, masterName ?? string.Empty);
if(viewResult == null)
throw new Exception(string.Format("The specified view {0} could not be found.", viewName));
var view = viewResult.View as RazorView;
if(viewResult == null)
throw new Exception(string.Format("The specified view {0} must be a Razor view.", viewName));
return view.ViewPath;
}
}
}
标签中看到服务器在某个级别接收到base64字符串没有任何问题。它匹配原始的,百分号和所有。