473,320 Members | 1,724 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,320 software developers and data experts.

asp.net C# writing hebrew to excel that uses asDB

Im using excel as a DB in asp.net .
I get a request with parameteres in hebrew.
I read them and then write them to excel file.
English and numbers looks fine in the excel file but the hebrew is
gibbrish.
So its something like:
string sName = Request.Form["Name"];
FileInfo f = new FileInfo(XLS_FILE_PATH);
StreamWriter w = f.AppendText();
w.WriteLine(sName );
w.Close();

Any ideas ?
Thanks.
Jan 23 '08 #1
3 2728
On Jan 23, 1:57 pm, Oren <orenlev...@gmail.comwrote:
Im using excel as a DB in asp.net .
I get a request with parameteres in hebrew.
I read them and then write them to excel file.
English and numbers looks fine in the excel file but the hebrew is
gibbrish.
So its something like:
string sName = Request.Form["Name"];
FileInfo f = new FileInfo(XLS_FILE_PATH);
StreamWriter w = f.AppendText();
w.WriteLine(sName );
w.Close();
You need to check at least two things:
1) Is sName correct in memory?
2) Is the file correct if you look at it in a hex editor?

If you can tell Excel to open a file in a particular encoding, try
UTF-8.

Jon
Jan 23 '08 #2
"Oren" <or********@gmail.comwrote in message
news:be**********************************@e10g2000 prf.googlegroups.com...
Im using excel as a DB in asp.net .
I get a request with parameteres in hebrew.
I read them and then write them to excel file.
English and numbers looks fine in the excel file but the hebrew is
gibbrish.
So its something like:
string sName = Request.Form["Name"];
FileInfo f = new FileInfo(XLS_FILE_PATH);
StreamWriter w = f.AppendText();
w.WriteLine(sName );
w.Close();

You should make sure the source page specifies UTF-8 as its encoding (so
that form data is actually posted up using UTF-8).

Try adding the line

Response.Write(w.Encoding.EncodingName);

Discover what encoding the file is in. I suspect it will be in a OEM
codepage not UTF-8.

--
Anthony Jones - MVP ASP/ASP.NET
Jan 23 '08 #3
On Jan 23, 3:11 pm, "Anthony Jones" <A...@yadayadayada.comwrote:

<snip>
Discover what encoding the file is in. I suspect it will be in a OEM
codepage not UTF-8.
Well the file written out by the StreamWriter will definitely be in
UTF-8, because that's the default encoding for a StreamWriter. It
doesn't mean that Excel is expecting that though!

Jon
Jan 23 '08 #4

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

Similar topics

1
by: Michael White | last post by:
HI All.. I have an asp page that queries a database and displays a report. There is a button on this page that I would like to dump the report into Excel. The code behind the button: var xl =...
2
by: bob | last post by:
My program copys things from a word document and puts them into an excel spreadsheet. The problem I have though is these annoying symbols that appear in place of spaces in the text after Ive...
3
by: Jon Brookins | last post by:
I'm reposting this question as the other post seems to have been sucked into the net black hole. I'll keep this short. I am trying to read and edit an Excel workbook in its native BIFF format. ...
2
by: Jeff Hamilton | last post by:
I have several ASP.Net pages which allow the user to view the content in Excel. To do this I am using the line 'Response.ContentType = "application/vnd.ms-excel"' in the Page_Load event. For Win...
4
by: preetinair033 | last post by:
Hi All, I have written a program to write the data into excel file (for eg: file.xls). This writes the data into the active sheet, ie, the sheet1. However I wish to write and read data from an...
2
by: Wernerh | last post by:
Could anyone tell me what is wrong with my statement? WSa1.Cells(17, 3).NumberFormat.Font = Bold WSa1 is the worksheet name in the Excel book I am writing to, then obviously the cell that needs...
5
by: alangbehn | last post by:
I have tried several ways when running a main report with multiple subreports included in Access and then using the Analyze with MS Excel routine. The output within Excel always places the data in a...
4
by: bonkbc | last post by:
hi! how can we take textbox data from a visual basic 6.0 form and write it to an excel worksheet once a command button is clicked? I've gotten very close to completing this on my own, here is...
1
by: =?Utf-8?B?ZmhpbGxpcG8=?= | last post by:
We have a code snippet that downloads data to Excel. it is writing row by row. This causes a performance issue. Any ideas on how to speed this up will be appreciated. Please find below an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.