Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
3d60ee18
Commit
3d60ee18
authored
Jun 23, 2011
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Sencha TT:
Fixed issue with JSON string containing \n
parent
5e4e144a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
intranet-rest-procs.tcl
tcl/intranet-rest-procs.tcl
+2
-2
intranet-rest-util-procs.tcl
tcl/intranet-rest-util-procs.tcl
+18
-0
No files found.
tcl/intranet-rest-procs.tcl
View file @
3d60ee18
...
...
@@ -1454,7 +1454,7 @@ ad_proc -private im_rest_post_object_type {
set data_list
[
list
]
foreach key
[
array
names hash_array
]
{
set value
$hash
_array
(
$key
)
lappend data_list
"
\"
$key
\"
:
\"
[
ns_quote
html
$value
]
\"
"
lappend data_list
"
\"
$key
\"
:
\"
[
ns_quote
json
$value
]
\"
"
}
set data
"
\[
{
[
join
$data
_list
", "
]
}
\]
"
...
...
@@ -1547,7 +1547,7 @@ ad_proc -private im_rest_post_object {
set data_list
[
list
]
foreach key
[
array
names hash_array
]
{
set value
$hash
_array
(
$key
)
lappend data_list
"
\"
$key
\"
:
\"
[
ns_quotehtml
$value
]
\"
"
lappend data_list
"
\"
$key
\"
:
\"
[
im_quotejson
$value
]
\"
"
}
set data
"
\[
{
[
join
$data
_list
", "
]
}
\]
"
...
...
tcl/intranet-rest-util-procs.tcl
View file @
3d60ee18
...
...
@@ -870,3 +870,21 @@ ad_proc -public im_rest_parse_xml_json_content {
return
[
array
get hash_array
]
}
ad_proc -public im_quotejson
{
str
}
{
Quote a JSON string. In particular this means escaping
single and double quotes, as well as new lines, tabs etc.
@author Frank Bergmann
}
{
regsub -all
{
\\
}
$str
{
\\\\
}
str
regsub -all
{
'
}
$str
{
\'
}
str
regsub -all
{
"
}
$str
{
\"
}
str
regsub -all
{
\n
}
$str
{
\\
n
}
str
regsub -all
{
\t
}
$str
{
\\
t
}
str
return
$str
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment