Skip to content

Commit 1de1502

Browse files
committed
added unicode support for assignment
1 parent 42f9052 commit 1de1502

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/json_file_module.F90

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ module json_file_module
246246

247247
generic,public :: assignment(=) => assign_json_file,&
248248
assign_json_file_to_string,&
249-
assign_string_to_json_file
249+
MAYBEWRAP(assign_string_to_json_file)
250250
procedure :: assign_json_file
251251
procedure,pass(me) :: assign_json_file_to_string
252-
procedure :: assign_string_to_json_file
252+
procedure :: MAYBEWRAP(assign_string_to_json_file)
253253

254254
! ***************************************************
255255
! private routines
@@ -1206,6 +1206,23 @@ subroutine assign_string_to_json_file(me,str)
12061206
end subroutine assign_string_to_json_file
12071207
!*****************************************************************************************
12081208

1209+
!*****************************************************************************************
1210+
!> author: Jacob Williams
1211+
!
1212+
! Alternate version of [[assign_string_to_json_file]], where "str" is kind=CDK.
1213+
1214+
subroutine wrap_assign_string_to_json_file(me,str)
1215+
1216+
implicit none
1217+
1218+
class(json_file),intent(inout) :: me
1219+
character(kind=CDK,len=*),intent(in) :: str
1220+
1221+
call me%assign_string_to_json_file(to_unicode(str))
1222+
1223+
end subroutine wrap_assign_string_to_json_file
1224+
!*****************************************************************************************
1225+
12091226
!*****************************************************************************************
12101227
!> author: Jacob Williams
12111228
!

src/tests/jf_test_46.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ subroutine test_46(error_cnt)
259259
end if
260260

261261
! now, we try them when an exception is active:
262-
json_f = CK_'{"x": 1.0e.2.1}' ! this will raise an exception
262+
json_f = '{"x": 1.0e.2.1}' ! this will raise an exception
263263
if (.not. json_f%failed()) then
264264
write(error_unit,'(A)') 'Error in json_file = string assignment operator : '//&
265265
'should have raised an exception'

0 commit comments

Comments
 (0)