Version19.239.6

This commit is contained in:
acanas 2020-05-21 12:30:08 +02:00
parent f913a82e54
commit 66cdccf008
2 changed files with 32 additions and 28 deletions

View File

@ -628,47 +628,50 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,timeoutMsg) {
} }
} }
// Escape except - _ . ! ~ * ' ( )
// Escape the same chars as encodeURIComponent(), but in ISO-8859-1 // Escape the same chars as encodeURIComponent(), but in ISO-8859-1
function getEscapedString (str) { function getEscapedString (str) {
const len = str.length;
var escaped = ''; var escaped = '';
for (var i = 0; i < str.length; i++) { for (var i = 0; i < len; i++) {
const code = str.charCodeAt(i); const code = str.charCodeAt(i);
var esc; switch (true) { // Escape punctuation marks except - _ . ! ~ * ' ( )
case (code <= 0x09): // Spec.
switch (true) { escaped += '%0' + code.toString(16).toUpperCase(); // %0X
case (code < 16):
esc = '%0' + code.toString(16).toUpperCase(); // %0X
break; break;
case (code >= 16 && code <= 32): case (code >= 0x10 && code <= 0x20): // Spec. 0x20 space
case (code >= 34 && code <= 38): case (code >= 0x22 && code <= 0x26): // 0x22 " 0x23 # 0x24 $ 0x25 % 0x26 &
case (code == 43): // '+' case (code == 0x2B): // 0x2B +
case (code == 44): // ',' case (code == 0x2C): // 0x2C ,
case (code == 47): // '/' case (code == 0x2F): // 0x2F /
case (code >= 58 && code <= 64): case (code >= 0x3A && code <= 0x40): // 0x3A : 0x3B ; 0x3C < 0x3D = 0x3E > 0x3F ? 0x40 @
case (code >= 91 && code <= 94): case (code >= 0x5B && code <= 0x5E): // 0x5B [ 0x5C \ 0x5D ] 0x5E ^
case (code == 96): // '`' case (code == 0x60): // 0x60 `
case (code >= 123 && code <= 125): case (code >= 0x7B && code <= 0x7D): // 0x7B { 0x7C | 0x7D }
case (code >= 127 && code <= 255): case (code >= 0x7F && code <= 0xFF): // ISO-8859-1 or windows-1252
esc = '%' + code.toString(16).toUpperCase(); // %XX escaped += '%' + code.toString(16).toUpperCase(); // %XX
break; break;
case (code >= 256): case (code >= 0x100):
esc = '%26%23' + code.toString(10) + '%3B'; // &#code; instead of %uXXXX escaped += '%26%23' + code.toString(10) + '%3B'; // &#code; instead of %uXXXX
break; break;
default: default: // 0x21 !
esc = str.charAt(i); // 0x27 ' 0x28 ( 0x29 ) 0x2A *
// 0x2D - 0x2E .
// 0x30 0 ... 0x39 9
// 0x41 A ... 0x5A Z
// 0x5F _
// 0x61 a ... 0x7A z
// 0x7E ~
escaped += str.charAt(i);
break; break;
} }
escaped += esc;
} }
return escaped; return escaped;
} }
/* /*
// To generate a table with the codification generated by escape() // To generate a table with the codification generated by encodeURIComponent()
// Copy the following code in https://playcode.io/ // and escape(), copy the following code in https://playcode.io/
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
var arr = []; var arr = [];
for(var i=0;i<256;i++) { for(var i=0;i<256;i++) {

View File

@ -557,10 +557,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.239.5 (2020-05-21)" #define Log_PLATFORM_VERSION "SWAD 19.239.6 (2020-05-21)"
#define CSS_FILE "swad19.238.2.css" #define CSS_FILE "swad19.238.2.css"
#define JS_FILE "swad19.239.5.js" #define JS_FILE "swad19.239.6.js"
/* /*
Version 19.239.6: May 21, 2020 Code refactoring in JS function to escape chars. (301411 lines)
Version 19.239.5: May 21, 2020 Fixed bug in charset in answer forms in exam prints. (301405 lines) Version 19.239.5: May 21, 2020 Fixed bug in charset in answer forms in exam prints. (301405 lines)
Version 19.239.4: May 20, 2020 Fixed bug listing user's exam prints. (301332 lines) Version 19.239.4: May 20, 2020 Fixed bug listing user's exam prints. (301332 lines)
Version 19.239.3: May 20, 2020 Fixed bugs removing exam prints in a course. Version 19.239.3: May 20, 2020 Fixed bugs removing exam prints in a course.