When using input with a textbox, if you paste information that contains carriage returns, are those carriage returns automatically stripped before assigning the information to the variable?
If not, can the carriage returns be detected?
input and carriage return
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
- Bone White
- Great Wyrm
- Posts: 1124
- Joined: Tue Aug 23, 2011 11:41 am
- Location: Cornwall, UK
Re: input and carriage return
To your first question, I don't know, but you can find out with my answer below, which explains how to detect them.aranginor wrote:When using input with a textbox, if you paste information that contains carriage returns, are those carriage returns automatically stripped before assigning the information to the variable?
If not, can the carriage returns be detected?
Use Wiki: encode() then search the encoded string for the code for carriage return. (%0D)
You can find a full list of encoded non-printing characters at the bottom of this page: http://www.w3schools.com/tags/ref_urlencode.asp
Re: input and carriage return
No, they are not stripped. I have a lib:token called RPEdit that uses a textbox and there are some things you have to do to clean stuff up. For example, if you want to change all the line feeds to html <br> tags, then you do this.
Another thing to note about textbox data being passed is that it converts all the ; to ;, so you'll need to replace those as well. If you end up using RPEdit, you have to code that string as "&#"+59 so the parser doesn't convert it inadvertently.
I also recommend using Notepad++ or similar product to filter your data, or to at least establish what kind of funky characters you may be processing. I would convert the windows open and close quotes to " as an example. I don't know the unicode for those offhand.
Code: Select all
[H: textboxText = replace(textboxText,"\\n","<br />")]
I also recommend using Notepad++ or similar product to filter your data, or to at least establish what kind of funky characters you may be processing. I would convert the windows open and close quotes to " as an example. I don't know the unicode for those offhand.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: input and carriage return
ok, here is what I am trying
[H: status = input("inputtext|Paste Here|Paste Test|TEXT|WIDTH = 40")]
[H: inputtext = replace(inputtext,"\\n","<br />")]
[r: inputtext]
I am copying from Notepad++ and pasting into the input. The data is as follows:
This<CR><LF>
is<CR><LF>
a<CR><LF>
test
This is the result:
This is a test
This is the desired result:
This
is
a
test
What am I doing wrong?
[H: status = input("inputtext|Paste Here|Paste Test|TEXT|WIDTH = 40")]
[H: inputtext = replace(inputtext,"\\n","<br />")]
[r: inputtext]
I am copying from Notepad++ and pasting into the input. The data is as follows:
This<CR><LF>
is<CR><LF>
a<CR><LF>
test
This is the result:
This is a test
This is the desired result:
This
is
a
test
What am I doing wrong?
Re: input and carriage return
Or use the one hosted at RPTools.net which has a filtering text box that makes it much easier to find what you want.Bone White wrote:You can find a full list of encoded non-printing characters at the bottom of this page: http://www.w3schools.com/tags/ref_urlencode.asp
http://www.rptools.net/index.php?page=h ... in-maptool
- Bone White
- Great Wyrm
- Posts: 1124
- Joined: Tue Aug 23, 2011 11:41 am
- Location: Cornwall, UK
Re: input and carriage return
You wrote all that to replace my ctrl+F shortcut?Azhrei wrote:Or use the one hosted at RPTools.net which has a filtering text box that makes it much easier to find what you want.Bone White wrote:You can find a full list of encoded non-printing characters at the bottom of this page: http://www.w3schools.com/tags/ref_urlencode.asp
http://www.rptools.net/index.php?page=h ... in-maptool
My keyboard will be indebted to you for the extra few seconds it takes to break
I have to ask however, why if I encode a carriage return in maptool and output it to chat i get "%0D" yet if I look at the entry on the page you linked, it shows "↵ crarr #8629 downwards arrow with corner leftwards = carriage return, U+21B5 NEW".
How do I use that information to search for carriage return? Do I search the non-encoded string for "#8629"?
Re: input and carriage return
Your ^F doesn't do the same thing. And you're welcome.Bone White wrote:You wrote all that to replace my ctrl+F shortcut?
Um, because I'm a dufus and didn't notice that you were talking about Wiki: encode()?I have to ask however, why if I encode a carriage return in maptool and output it to chat i get "%0D" yet if I look at the entry on the page you linked, [...]
The page I linked has no help whatsoever for what you're talking about (encoded ASCII). It's geared towards helping people find the HTML entity for a particular glyph. My bad.