473,388 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Issues while encoding

hello all,

I am using vb.net to read a image file and then tryied to convert it to a
string using the following code

Dim fs As FileStream = New FileStream(filename,
FileMode.OpenOrCreate, FileAccess.Read)
Dim rawData() As Byte = New Byte(fs.Length) {}
fs.Read(rawData, 0, System.Convert.ToInt32(fs.Length))
fs.Close()

dim filedata as string
filedata=System.Text.ASCIIEncoding.ASCII.GetString (rawData)

Upto this point it get converted into string

Now I am passing this string to some web service where i want to get the
image back from this string

I write my code like this

Dim bw As BinaryWriter
Dim outbuff() As Byte
outbuff =
System.Text.ASCIIEncoding.ASCII.GetBytes(filedata )
fs = New FileStream("C:\" & nodeattrib.Value,
FileMode.Create, FileAccess.Write)
fs.Write(outbuff, 0, outbuff.Length)

File is created in the path specified but, i cannot open it.

Can Anyone help me out in this case.

It is very urgent

Thanks in advance
--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )

Nov 23 '05 #1
1 833
Sunil,

You can not get it in a string, a string is using unicode. However it goes
in a bytearea.

I did put (some minutes ago) this sample on our website, you can try it.

http://www.vb-tips.com/default.aspx?...2-dd138c31a825

I hope this helps,

Cor
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm...
6
by: Microsoft News | last post by:
Hi, I have been using several http server code examples from the web, include one from msdn, and I can't seem to get a simple http server thread working. I can connect the server successful...
11
by: Peter Rietkerk | last post by:
I have a few questions regarding the referencing of web services using this toolkit. I am currently trying to reference a specific URL to WSDL that was generated on a local server. Does anyone know...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
4
by: looping | last post by:
Hi, I had some issues with XMLRPCServer and I try to validate my workaround. My first try was this (somewhat self explaining code): from DocXMLRPCServer import DocXMLRPCServer from...
0
by: Andreas | last post by:
Hi, Im trying to consume a webservice which i have no control over, it is built in j2ee, and I want to consume it using .Net. I have tried both, and the soap generated from .Net looks...
3
by: Rich | last post by:
I am writing two programs that are part of a Bulletin board system. The program works right, but when information is downloaded, the server program refuses to send more than 9 Kilobytes of data to...
39
by: CJM | last post by:
I'm in the process of partially revamping a corporate website. My main brief was to reorganise much of the content and to update a lot of the copy, but in the process I'm also trying to correct...
15
by: Logician | last post by:
I want to use UNIX to develop c# applications, does anyone have any details of compatibility issues?
2
by: George Sakkis | last post by:
I'm trying to use codecs.open() and I see two issues when I pass encoding='utf8': 1) Newlines are hardcoded to LINEFEED (ascii 10) instead of the platform-specific byte(s). import codecs f =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.