Comments (7)
@joefeser 👍 I'm way late to the party, but ...
We could detect and strip out the BOM ourselves, but this is a potentially surprising transformation of the blob's original data
It would have been nice though to have an overload .DownloadText(bool stripByteOrderMark)
, so that the original method would just do the un-"surprising" thing and the overload would allow the dev to explicitly call for stripping the BOM.
from azure-storage-net.
Seriously, 5 months with no comment?
from azure-storage-net.
I created an extension method DownloadString
for CloudBlockBlob
and used the same code which is used in WebClient.DownloadString
. Here you can find the code: How to get rid of BOM when downloading text from azure blob
from azure-storage-net.
Closed my issue. Found the same issue.
from azure-storage-net.
Apologize for the delay.
DownloadText api is currently a simple utility api that takes the bytes and passes its to corresponding encoder to get a string back. It was not designed to map one to one with File.ReadAllText().
We will evaluate a fix for above issue for our future release. This can only be part of our next breaking change release as it changes the API behavior. For now, you can use the workaround suggested by @rzio
from azure-storage-net.
@vinaysh-msft If it passed it to the correct encoder, it should have dealt with the BOM correctly and not returned it as part of the string.
from azure-storage-net.
We have evaluated this issue. When a blob is downloaded using DownloadText(), we apply an encoding to construct a string (by default, we use .NET's UTF-8 implementation). Applying the encoding to the string does not strip out the BOM. We could detect and strip out the BOM ourselves, but this is a potentially surprising transformation of the blob's original data, especially given that the Content-Encoding header might also be specified on the blob with conflicting info.
See also that the same behavior exists in WebClient.DownloadString: http://stackoverflow.com/questions/1317700/strip-byte-order-mark-from-string-in-c-sharp
Note that you can pass your own Encoding implementation that strips out the BOM in the call to GetString() if this behavior is desired.
I am closing this old issue now; feel free to raise another issue if you have additional concerns related to encoding.
from azure-storage-net.
Related Issues (20)
- Server Failed to authenticate the request.
- BlobClient chop off the name when the blob name contains #
- Token for Storage Account- Managed Identity
- Questions regarding Infrastructure encryption
- This repo is missing important files
- Container soft delete does not seem to be supported in ChinaNorth2
- Data factory custom activity (batch) -> storage - 403 BlobAccessDenied HOT 1
- BlobClient, file intermittently not released with UploadAsync HOT 1
- Trying to create a container, inside a contaner HOT 1
- CloudBlob.DownloadRangeToByteArray() hangs in some circumstances
- Html encoded meta data displays as encoded in Blob Container Storage Account portal
- ErrorCode vs ExtendedErrorInformation.ErrorCode HOT 1
- File upload very slow for File shares v12 for large files.
- Custom metadata for Azure queue message
- Large file - fileshare performance
- Functionality impact of Azure Classic Resource provider retirement on WindowsAzure.Storage 5.0.2
- Policy: "Storage accounts should restrict network access" is triggered even public access is completely disabled.
- Random timeouts for Blob Operations
- [infic-functions] Function App Down or Reporting Errors
- QueueClient.SendMessage returns 405
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-storage-net.