Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:DecodeEncode
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function _getBoolean( boolean_str ) -- from: module:String; adapted -- requires an explicit true local boolean_value if type( boolean_str ) == 'string' then boolean_str = boolean_str:lower() if boolean_str == 'true' or boolean_str == 'yes' or boolean_str == '1' then boolean_value = true else boolean_value = false end elseif type( boolean_str ) == 'boolean' then boolean_value = boolean_str else boolean_value = false end return boolean_value end function p.decode( frame ) local s local subset_only s = frame.args['s'] or '' subset_only = _getBoolean(frame.args['subset_only'] or false) return p._decode( s, subset_only ) end function p._decode( s, subset_only ) local ret = nil; s = mw.ustring.gsub( s, ' ', ' ' ) -- Workaround for bug:   gets properly decoded in decode, but   doesn't. ret = mw.text.decode( s, not subset_only ) return ret end function p.encode( frame ) local s local charset s = frame.args['s'] or '' charset = frame.args['charset'] return p._encode( s, charset ) end function p._encode( s, charset ) -- example: charset = '_&Β©βΒ°\\\"\'\=' -- do escape with backslash not %; local ret if charset ~= (nil or '') then ret = mw.text.encode( s, charset ) else -- use default: chartset = '<>&"\' ' (outer quotes = lua required; space = NBSP) ret = mw.text.encode( s ) end return ret end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Mono
(
edit
)
Template:Navbox wikitext-handling templates
(
edit
)
Template:Ombox
(
edit
)
Template:Para
(
edit
)
Template:Sandbox other
(
edit
)
Template:Tl
(
edit
)
Module:Arguments
(
edit
)
Module:DecodeEncode
(
edit
)
Module:DecodeEncode/doc
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Yesno
(
edit
)