how can I enter a 2KB formatted TXT (line breaks) that should get URL-Encoded? Just pasting it into the input line doesn't work as the result is not formatted in any way.
https://www.dropbox.com/s/z934uvy6bjz98e3/Screenshot%202016-04-13%2014.28.16.PNG?dl=0
If you have a really complex text, I recommend you to just keep the text in a plain text file somewhere in your disk, and use a File Dynamic Value to reference it, and wrap the whole thing in your URL-Encode Dynamic Value.
Some steps:
Create a file with your content
In your URL-Encode dynamic value, right-click on the Input field and pick File > File Content
Click on the newly created File (Not specified) token, and you'll be prompted to either pick or drag-and-drop a file
You should be good to go. And whenever the file changes, you can send the request, and it should be up-to-date, it's just a pointer to the file.
If you use proper URL encoding, the linebreaks \n should be encoded as %0A. This
foo
bar
baz
will be encoded as
foo%0Abar%0Abaz%0A
Related
I have API calls that return files that are gzipped and then base64 encoded so that they can be returned as part of JSON responses. I'd like to be able to decode those files. At the moment I have to copy the base64 test, decode it and then gunzip the result.
Is there an extension for this or can I create one?
copy response text
go to header or params or body tab
paste copied text any value field
select all pasted text
mouse right-click -> encoding -> URL-encoding/Base64 -> encode/decode
paste text to input field
or use Atom + escape-utils plugin
I have an app where I allow the user to enter data and then I'd like to open a .bin file, search for a particular position and then paste the data the user entered into the file.
Not sure how to go about doing this, looked over all of the FileOpen, FileRead, FileWriteEx but can't come up with a solution. What I'm doing now is opening up the file in a Hex Editor, searching for a particular string and then pasting the text. Doing this all manually, would like to figure out a way to do it automatically.
Is this possible in PB? What I'm pasting into the .bin file is actual text.
Below is an example....opening up in Hex editor and searching for 'Test...', once I find it then I skip 3 positions and paste my text.
[1] https://i.stack.imgur.com/RsVxS.png
Result after PB pastes text into .bin file
You probably want to create a dll in .Net which communicates with PB via COM. The dll would handle the Hex editing of the file after the PB application sends it the string entered by the user.
You need to convert the hex codes the user inputs to integers, then use the char function to convert them to characters. It's those characters you need to write to the file.
Part of my source code displays text in English that uses common text formatting characters (E.g.: \n: "This is my\nstring"). When I call lupdate and open the .ts file in Qt Linguist, it correctly displays the formatted text in the source text preview space (so without the \n or else).
The problem is that, when I translate the string and put the formatting characters in the translation and run the application with the translation file, my app reads the special characters as normal ones!
How may I overcome this problem? How can I put the necessary text formatting so the translation procedure don't generate such kind of bugs?
When you translate your app, you should press Enter, where you see \n.
For example,you see this string in source code
This is my\nstring
In linguist you should write:
This is my[here press Enter]
string.
When you run app with this translation, you'll see that all good.
I hope, it helps.
How do I add an html entity to my CSV?
I have an asp.net, sql server that generates html, excel, and csv files. Some of the data needs to have the ‡ entity in it. How do I get it to output to my CSV correctly? If I have it like this: ‡, then it gets screwed up but if I output it with the entity code, the CSV outputs that text.
Non-printable characters in a field are sometimes escaped using one of several c style character escape sequences, ### and \o### Octal, \x## Hex, \d### Decimal, and \u#### Unicode.
So just escape your non-ascii character C#-style and you'll be fine.
I'm not sure what you mean by "it gets screwed up".
Regardless, it is up to the receiving program or application to properly interpret the characters.
What this means is that if you put ‡ in your csv file then the application that opens the CSV will have to look for those entities and understand what to do with them. For example, the opening application would have to run an html entity decoder in order to properly display it.
If you are looking at the CSV file with notepad (for example) then of course it won't decode the entities because notepad has no clue what html entities are or even what to do when it finds them.
Even Internet Explorer wouldn't convert the entities for display when opening a CSV file. Now if you gave it a .html extension then IE would handle the display of the file with it's html rendering engine.
I am using file upload mechanism to upload file for an employee and converting it into byte[] and passing it to varBinary(Max) to store into database.
Now I what I have to do is, if any file is already uploaded for employee, simply read it from table and show file name. I have only one column to store a file and which is of type VarBinary.
Is it possible to get all file information from VarBinary field?
Any other way around, please let me know.
If you're not storing the filename, you can't retrieve it.
(Unless the file itself contains its filename in which case you'd need to parse the blob's contents.)
If the name of the file (and any other data about the file that's not part of the file's byte data) needs to be used later, then you need to save that data as well. I'd recommend adding a column for the file name, perhaps one for its type (mime type or something like that for properly sending it back to the client's browser, etc.) and maybe even one for size so you don't have to calculate that on the fly for each file (useful when displaying a grid of files and not wanting to touch the large blob field in the query that populates the grid).
Try to stay away from using the file name for system-internal identity purposes. It's fine for allowing the users to search for a file by name, select it, etc. But when actually making the request to the server to display the file it's better to use a simple integer primary key from the table to actually identify it. (On a side note, it's probably a good idea to put a unique constraint on the file name column.)
If you also need help displaying the file to the user, you'll probably want to take the approach that's tried and true for displaying images from a database. Basically it involves having a resource (generally an .aspx page, but could just as well be an HttpHandler instead) which accepts the file ID as a query string parameter and outputs the file.
This resource would have no UI (remove everything from the .aspx except the Page directive) and would manually manipulate the response headers (this is where you'd set the content type from the file's type), write the byte stream to the client, and end the response. From the client's perspective, something like ~/MyContent/MyFile.aspx?fileID=123 would be the file. (You can suggest a file name to the browser for saving purposes in the response headers, which you'd probably want to do with the file's stored name.)
There's no shortage of quick tutorials (some several years old, it's been around for a while) on how to do this with images. Just remember that there's essentially no difference from the server's perspective if it's an image or any other kind of file. All the server needs to do is send the type in the response headers and write the file's bytes to the client. How the client handles the file is up to the browser. In the vast majority of cases, the browser will know what to do (display an image, display via a plugin a PDF, save a .doc, etc.).