Internet explorer 11 file download rename file name - html

Anyone knows why IE11 is renaming my file name that has ’ whenever I download it?
Could it be some character encoding settings?
Attached picture displays the problem. The original file name I save as was Test’s.pdf

I manage to resolve it!
Discovered the bug in my response header as my file name requires encoding
I changed
context.Response.AddHeader("Content-Disposition", "inline;attachment; filename=\"" + fileName + "\"");
to
context.Response.AddHeader("Content-Disposition", string.Format("attachment; filename*=UTF-8''{0}", HttpUtility.UrlPathEncode(fileName)));

Related

How to save angular.json as UTF-8?

I am deploying an Angular project on Ubuntu and am running into This issue ("Unexpected token m in JSON at position 0.")
Someone suggested that I resave my angular.json file as UTF-8. I'm not exactly sure how to do that, do I need to add code or just change a file type?
If anyone knows how to do that (and why that might help) that would be great. Thanks!
To change the encoding of a file within vscode, do the following:
Open the file.
Look in the bottom right corner and press the name of the current encoding. In my example image below it is already UTF-8.
Select "save with encoding".
Pick the encoding you want to save the file with.

Online Doc Viewer

I have a file hosted on AWS Linux AMI. The link is http://54.179.188.146/a/a.docx I can visit the link and download the file.
I am trying to use Microsoft Online Doc Viewer to view the Word File online at this link https://view.officeapps.live.com/op/view.aspx?src=http://54.179.188.146/a/a.docx but it returns a page stating "An error occurred We're sorry, but for some reason we can't open this for you."
I had chmod the file to 775 but it still cannot view.
I had uploaded to another server and it is working. May I know what is wrong? Is it a server configuartion issue? Please advise.
Thanks.
This is Old but giving some more pointers to the new visitors , i am posting the consolidated answer for the root cause of the "We’re sorry, but for some reason we can’t open this for you" error in https://view.officeapps.live.com/op/view.aspx?src=
If you see the error, "We’re sorry, but for some reason we can’t open this for you," it means the document could not be found or could not be displayed. Likely reasons include:
There’s no document to be found at the URL you provided. Make sure
you provide the correct URL.
The document is too large. Word and PowerPoint documents must be less
than 10 megabytes; Excel must be less than five megabytes.
The document was not saved in a format that is supported for opening
in a web browser. Try saving your document in one of the following
formats:
Word: docx, docm, dotm, dotx
Excel: xlsx, xlsb, xls, xlsm
PowerPoint: pptx, ppsx, ppt, pps, pptm, potm, ppam, potx, ppsm
You need to sign in or provide a password to open the document. Make
the document publically available to view.
The document’s file name contains invalid characters. Try encoding
the file name when you type the document’s URL, or rename the file to
use only letters and numbers. For example, to encode a URL that
includes an ampersand (i.e. &), you would type %26 for the ampersand
character. For more information about URL encoding, also known as
percent encoding.
more info can be found here
The value after "src=" should be URL-encoded. See details on MS Page
You should checked all reasons from here
There’s no document to be found at the URL you provided. Make sure you provide the correct URL.
Try to open file from browser.
Make sure you don't try to send on preview service path of the file from your local host. To which, obviously, there is no access from the Internet.
Path to file must be http:// or https://
If path to your file start with https:// make sure your site have necessary secure certificate.
Domain name matters.
Will not be open in preview service
http://185.231.70.200/vacuumcleanerprocedure.doc
Will be open in preview service
http://domainname.com/vacuumcleanerprocedure.doc
The document is too large. Word and PowerPoint documents must be less than 10 megabytes; Excel must be less than five megabytes.
Try different files with different Microsoft file types.
The document was not saved in a format that is supported for opening in a web browser. Try saving your document in one of the following
formats: Word: docx, dotx Excel: xlsx, xlsb, xls, xlsm PowerPoint:
pptx, ppsx, ppt, pps, potx, ppsm
Try different files with different Microsoft file types.
You need to sign in or provide a password to open the document. Make the document publicly available to view.
File permission and folders mode should be 775.
Check if in .htaccess file of your apache server there are allow access to ms-office files.
Check if your file available from internet. Try to open file from browser. If you see “You don't have permission to access filename on this server” see answer here
The document’s file name contains invalid characters. Try encoding the file name when you type the document’s URL, or rename the file to
use only letters and numbers. For example, to encode a URL that
includes an ampersand (&), you would type %26 for the ampersand
character. For more information about URL encoding, also known as
percent encoding, see Percent-encoding on Wikipedia.
The value after "src=" should be URL-encoded. When you place the link on the preview service, it already encodes it for preview. Additionally, I may encode the link here, but the result will be the same.

Text encoding for sound recording copyright symbol in a .tsv file

I'm having an issue where I can't get this symbol "℗" to render in a .tsv file. I'm using powershell to add data to my .tsv that has copyright info, so I need to have it copy over correctly. I use add-content -path C:\blah and I include the -encoding parameter at the end, but all of the encoding choices I've tried cannot render this sound recording copyright symbol. Anyone have any idea if this can work? UTF8 and UTF32 render the © symbol correctly, for what it's worth. What's also sort of funny is that Powershell ISE can render the symbol correctly.
Thanks for any help.
Edit: I'm thinking now it may just be a limitation of the .tsv file? I just tried opening the .tsv in excel, pasting the "℗" symbol into an empty cell, and when I save and re-open the file, the "℗" is replaced by a "?".
Edit 2: If I use import-csv -path -delimiter and import the .tsv, the symbol does render correctly in Powershell. I would like it to render correctly in Excel if that's possible. I also tried to load it using Google Sheets but it had the same problem.
This turns out to be sort of a workaround I think, but the end result is what I wanted.
There seems to be some type of problem with excel and the encoding of .tsv, .csv, etc. So what I found worked for me was opening whatever file I wanted (in Excel), saving as a "Unicode .txt", then just renaming the file extension from .txt to .tsv. The file still opens correctly as a .tsv spreadsheet, but for whatever reason the encoding works now so that the "℗" saves correctly. And it looks like I only need to do this once and I can keep appending to the same .tsv. Strange solution, but I'll take it.
And just to clarify, if I open the file as a .txt in Excel, it also retains the correct formatting. I just changed the extension to .tsv so that a double click will open to Excel rather than notepad. I believe the file is technically still saved as a Unicode .txt file.

CodedUI test does not read data from CSV input file

I am having difficulty mapping a CSV file with the Coded UI test method. This is most likely a stupid question but I cannot seem to find a solution for my problem, at least not one that works. I have made sure to set the property of the CSV file to Copy always.
I have also imported the CSV file by writing the following line above the test method.
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\Data\\login.csv", "login#csv", DataAccessMethod.Sequential), DeploymentItem("login.csv"), TestMethod]
The file name is login.csv and it resides in the Data folder.
The test will compile without any problem but once the test executes the fields that should receive input from the CSV file are left empty and the execution is interrupted. I've tried replacing the data from the CSV file by using Strings and it works perfectly fine. The piece of code I am using to import each parameter is:
TestContext.DataRow["Username"].ToString()
Also, the CSV file contains something along the following lines:
Username,Password,Fullname
admin#mail.com,password,Admin
Is there anyone who can point what it is I am forgetting.
Update: I pinpointed the issue, it seems like the issue only revolves around the first column in the csv file. When I try to import any of the other values it works perfectly fine.
Some text files start with a Byte Order Mark (BOM). The CSV reader within Coded UI does not handle the BOM and treats it as part of the first field name. The screen shot below shows the debug trace of a CSV file with a BOM and that same file shown in Notepad++. The DataRow.ItemArray[...] values are as expected. The DataRow.Table.Columns.ResultsView[...] shows the field names, but the first field name includes the BOM.
This CSV file with a BOM was created in Visual Studio using Solution Explorer => Add => New item => C# => General => Text file. Previously I have created a spread sheet with Microsoft Excel and saved it as a CSV file, that file did not have a BOM. I have also created files with Notepad++ and saved as CSV and they did not have a BOM. It appears that Visual Studio creates files with a BOM but when editing CSV files it does not add a BOM.
Visual Studio can create files with the correct encoding. Within "Step 2 - Create a data set" of this Microsoft page it states the text below. (Thanks also to Holistic Developer for providing very similar details in a comment.):
It is important to save the .csv file using the correct encoding. On the FILE menu, choose Advanced Save Options and choose Unicode
(UTF-8 without signature) – Codepage 65001 as the encoding.
For Visaul Studio 2010, i could solve issue be selecting "Western European (Windows) - Codepage 1252" encoding for CSV files.
Summary of steps:
In visual studio 2010, Open CSV file > Go to File menu > Select " Advanced Save Options" > Select "Western European (Windows) - Codepage 1252" > Save.
This should help.
This is not the best solution but its kind of a workaround. I simply set the first element to something random and since I don't need access to the first element it doesn't matter that I don't have access to it.
If anyone finds a correct way to solve this problem I'd be grateful for your solution.

Chrome Extension internationalization error?

When i add "default_locale": "en", to my manifest file, then package it and try to upload it, i get the error message saying, An error occurred: Message JSON file must be in UTF-8 encoding. ... But this is how they tell you to set it up in their i18n page... What is the problem?
I'm not sure he's missing the Byte Order Mark -- which is neither required nor recommended in UTF-8 (as endianness isn't relevant) -- I think it's just the file encoding. I believe Notepad adds the BOM by default when you save as UTF-8, but I always save files without it as some programs that receive UTF-8 data don't expect the BOM.
But yes, bottom line, go to the file and Save As in UTF-8. If you are using Notepad, I'd recommend using a different editor -- for JS something lightweight like Notepad++ works well -- so that you can change the default encoding, among many other benefits.
It seems that you simply missing Byte Order Mask in front of your manifest file. If you are on Windows simply open it in Notepad, click File -> Save As and choose UTF-8 from Encoding combo box.
Obviously you can use other tools to "convert" to UTF-8...
just solved the issue... After googling awhile... turns out MS notepad is inadequate even with utf-8 encoding... Download "Notepad2"... and set the encoding to utf-8... somehow it works now!