Last active
May 17, 2016 12:29
-
-
Save rodionbykov/a06af326f2eb1e78bd94b9095c33594c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- attempt 1: fail, this directive is affecting only characters in CFM template ---> | |
<cfprocessingdirective pageEncoding="utf-8" /> | |
<cfparam name="FORM.exampleInput" default="" /> | |
<cfparam name="FORM.anotherInput" default="" /> | |
<!--- attempt 2: not seem to have result ---> | |
<cfset SetEncoding("FORM", "utf-8") /> | |
<!--- attempt 3: not seem to have result ---> | |
<cfset chardecode=CharsetDecode("#FORM.exampleInput# #FORM.anotherInput#", "utf-8") /> | |
<cfset charencode=CharsetEncode(chardecode, "utf-8") /> | |
<cfset structOutput = {'name'=charencode} /> | |
<cfset jsonOutput = serializeJSON(structOutput) /> | |
<!--- attempt 4: added charset to cfhttp, no result ---> | |
<cfhttp url="http://localhost/index.cfm" method="POST" proxyServer="localhost" proxyPort="8080" charset="utf-8"> | |
<!--- attempt 5: added header, no result ---> | |
<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" /> | |
<cfhttpparam type="body" value="#jsonOutput#" /> | |
</cfhttp> | |
<!--- despite processing directive above, even inline UTF-8 is not sent properly in body, still being replaced by ????? ---> | |
<cfhttp url="http://localhost/index.cfm" method="POST" proxyServer="localhost" proxyPort="8080" charset="utf-8"> | |
<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" /> | |
<cfhttpparam type="body" value="Съешь еще этих французских булочек да выпей чаю" /> | |
</cfhttp> | |
<!--- finally solution that worked ---> | |
<cfhttp url="http://localhost/index.cfm" method="POST" proxyServer="localhost" proxyPort="8080" charset="utf-8"> | |
<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" /> | |
<cfhttpparam type="body" value="#ToBinary(ToBase64(jsonOutput))#" /> | |
</cfhttp> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Bootstrap 101 Template</title> | |
<!-- Bootstrap --> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> | |
<!-- Latest compiled and minified JavaScript --> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | |
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<h1>Hello, world!</h1> | |
<form method="post" action="test_form.cfm"> | |
<fieldset class="form-group"> | |
<label for="formGroupExampleInput">Example label</label> | |
<input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input" name="exampleInput"> | |
</fieldset> | |
<fieldset class="form-group"> | |
<label for="formGroupExampleInput2">Another label</label> | |
<input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input" name="anotherInput"> | |
</fieldset> | |
<fieldset class="form-group"> | |
<button type="submit" class="btn btn-default">Send</button> | |
</fieldset> | |
</form> | |
<div class="container"> | |
<cfoutput> | |
#FORM.exampleInput# | |
<br /> | |
#FORM.anotherInput# | |
</cfoutput> | |
<cfdump var="#FORM#" /> | |
<cfdump var="#structOutput#" /> | |
<cfdump var="#jsonOutput#" /> | |
</div> | |
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment