Skip to content

Commit 5da7c98

Browse files
committed
COLDBOX-1370 #resolve
renderData not sending encoding with content-type header
1 parent 9c7a412 commit 5da7c98

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

system/RestHandler.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ component extends="EventHandler" {
425425
* When you need a really hard stop to prevent further execution ( use as last resort )
426426
*/
427427
if ( arguments.abort ) {
428-
event.setHTTPHeader( name = "Content-Type", value = "application/json" );
428+
event.setHTTPHeader( name = "Content-Type", value = "application/json; charset=utf-8" );
429429
event.setHTTPHeader( statusCode = "#arguments.event.STATUS.NOT_AUTHENTICATED#" );
430430

431431
writeOutput( toJson( prc.response.getDataPacket( reset = this.resetDataOnError ) ) );
@@ -477,7 +477,7 @@ component extends="EventHandler" {
477477
* When you need a really hard stop to prevent further execution ( use as last resort )
478478
*/
479479
if ( arguments.abort ) {
480-
event.setHTTPHeader( name = "Content-Type", value = "application/json" );
480+
event.setHTTPHeader( name = "Content-Type", value = "application/json; charset=utf-8" );
481481
event.setHTTPHeader( statusCode = "#arguments.event.STATUS.NOT_AUTHORIZED#" );
482482

483483
writeOutput( serializeJSON( prc.response.getDataPacket( reset = this.resetDataOnError ) ) );

system/web/context/RequestContext.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ component serializable="false" accessors="true" {
17441744
// Automatic Content Types by marshalling type
17451745
switch ( rd.type ) {
17461746
case "JSON": {
1747-
rd.contenttype = "application/json";
1747+
rd.contenttype = "application/json; charset=#arguments.encoding#";
17481748
if ( arguments.jsonAsText ) {
17491749
rd.contentType = "text/plain";
17501750
}

0 commit comments

Comments
 (0)