473,586 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem showing hebrew on my site.

I have a problem showing hebrew on my site.
Please, help.

Here is the code :

web.config
=======
<configuratio n>
<system.web>
<customErrors mode="Off"/>
<identity impersonate="tr ue"/>
<globalizatio n
requestEncoding ="windows-1255"
responseEncodin g="windows-1255"
fileEncoding="w indows-1255"
culture="he-IL"
uiCulture="he-IL"
/>
</system.web>
</configuration>

....
I put web.config on the main directory of the site (where there is
index.html - main default page).

test.aspx
======
<%@ Import Namespace="Syst em.IO" %>
<html>

<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=WINDOWS-1255">
<script runat="server" charset="window s-1255">
sub Page_Load(sende r as Object, e as EventArgs)
Dim FILENAME as String = Server.MapPath( "test.txt")

Dim objStreamReader as StreamReader
objStreamReader = File.OpenText(F ILENAME)

Dim contents as String = objStreamReader .ReadToEnd()

test_text.text = contents.Replac e(vbCrLf, "<br>")

objStreamReader .Close()

test_text.reado nly = true
end sub
</script>
<title>Test</title>
</head>

<body text = "black" bgcolor = "#ffffff">

<form runat="server">
<asp:textbox TextMode = "MultiLine" id = "test_text" runat="server" width =
"300" height = "300" />
</form>

</body>
</html>

test.txt is a simple text ascii file with some Hebrew.

The site supports dot-net (it's a windows dot net platform).
The page is loaded correctly, except instead of Hebrew I see many question
marks (something like : ??? ??? ??????)

What is wrong on my code ?

Thanks :)
Sep 5 '08 #1
4 2223
Mr. X. wrote:
test.txt is a simple text ascii file with some Hebrew.
The site supports dot-net (it's a windows dot net platform).
The page is loaded correctly, except instead of Hebrew I see many question
marks (something like : ??? ??? ??????)

What is wrong on my code ?
Could it be that your text file ain't windows-1255 but some toher character
encoding like utf-8?

--

//Aho
Sep 5 '08 #2
test.txt is OK.

What I see that StreamReader should be constructed with an Encoding.
something like :
objStreamReader = new(FILENAME, Encoding.GetEnc oding("windows-1255"))

but the above runs out of compilation errors, and I didn't find what is the
exact syntax for that (for the rest of my code).

Thanks :)
Sep 5 '08 #3
Well.
A little mistake.
I sould write :
objStreamReader = new StreamReader(FI LENAME,
Encoding.GetEnc oding("windows-1255"))

Thanks, anyway.
Sep 5 '08 #4
"Mr. X." <no_spam_please @nospam_please. comwrote in message
news:g9******** **@news4.netvis ion.net.il...
>I have a problem showing hebrew on my site.
Please, help.

Here is the code :

web.config
=======
<configuratio n>
<system.web>
<customErrors mode="Off"/>
<identity impersonate="tr ue"/>
<globalizatio n
requestEncoding ="windows-1255"
responseEncodin g="windows-1255"
fileEncoding="w indows-1255"
culture="he-IL"
uiCulture="he-IL"
/>
</system.web>
</configuration>

...
I put web.config on the main directory of the site (where there is
index.html - main default page).

test.aspx
======
<%@ Import Namespace="Syst em.IO" %>
<html>

<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=WINDOWS-1255">
<script runat="server" charset="window s-1255">
sub Page_Load(sende r as Object, e as EventArgs)
Dim FILENAME as String = Server.MapPath( "test.txt")

Dim objStreamReader as StreamReader
objStreamReader = File.OpenText(F ILENAME)

Dim contents as String = objStreamReader .ReadToEnd()

test_text.text = contents.Replac e(vbCrLf, "<br>")

objStreamReader .Close()

test_text.reado nly = true
end sub
</script>
<title>Test</title>
</head>

<body text = "black" bgcolor = "#ffffff">

<form runat="server">
<asp:textbox TextMode = "MultiLine" id = "test_text" runat="server" width
= "300" height = "300" />
</form>

</body>
</html>

test.txt is a simple text ascii file with some Hebrew.

The site supports dot-net (it's a windows dot net platform).
The page is loaded correctly, except instead of Hebrew I see many question
marks (something like : ??? ??? ??????)

What is wrong on my code ?
File.OpenText assumes the file is UTF-8.
Add:-

<%@ Import Namespace="Syst em.Text" %>

to your page and use:-

objStreamReader = new StreamReader(FI LENAME, Encoding.GetEnc oding(1255));

--
Anthony Jones - MVP ASP/ASP.NET

Sep 5 '08 #5

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

Similar topics

5
2678
by: Mr. x | last post by:
Hello, I am building a web-site. For a reason, I don't know why, if I put my site on my computer - I see hebrew character fine, but when I put my site on hosting company I don't see hebrew character. In my html page there is a line in the head section : <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
5
2804
by: Mr. x | last post by:
Hello, I would like to change web.config file so it will fit to Hebrew pages. I need a sample of how to do that (configuration section, but I need a sample code, please). Thanks :)
2
9215
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends - I see hebrew, it is just sending by myself using *.aspx scripts). In web.config I have the following : <configuration> <system.web>
7
2822
by: Elie Nacache | last post by:
Hi all, I develop an application (JAVA/JSP) on RedHat PostgreSQL 7.4.3 with PostgreSQL 7.4.2 JDBC3 with SSL (build 213). This application needs to serve pages in LATIN1 and Hebrew. For that I create 2 Databases, one DB in UNICODE encoding with client encoding LATIN1 when in the JSP the charset encoding is iso-8859-1 and it's working fine...
40
3094
by: Shmuel (Seymour J.) Metz | last post by:
I'd like to include some Hebrew names in a web page. HTML 4 doesn't appear to include character attributes for ISO-8859-8. I'd prefer avoiding numeric references, e.g., "&#x05E9;&#x05DE;&#x05D5;&#x05D0;&#x05DC;". Is there currently a standardized set of character attributes for Hebrew? If so, is there a downloadable set of definitions for...
2
2392
by: Zippy | last post by:
Hi. I'm working in Access 2003 - standard English version - and am trying to write a program with a Hebrew user interface. Being that Hebrew is a right-to-left language, the orders of columns in a pulldown list, 'left' control position property, etc, are not easy to work with. 1. What do I need for a fully Hebrew version of Access. ...
2
2994
by: Mitul | last post by:
Hello Friend, I am having very strange problem with mail function. As I have to implement Newsletter things in my hebrew site. I have implemented everything but having problem with subject line is not display on any one of mail services. Mail display body part properly in hebrew but subject line having problem its display junk character in...
3
4654
by: Michael Groysman | last post by:
Hello. I am working in classic asp. Some of the field values inserted in hebrew language(for mutli lang. site). It shows question marks or other symbols inside asp page. I tried different codepage and charset commands but it does not work. Please advise. Michael
4
3500
by: ofiras | last post by:
Hi everyone, I made a web page in PHP, and included in it PHP file, which prints Hebrew text. I used the web page to include other files, but only this particular PHP file makes my Hebrew look like gibberish ("׳‘׳—׳¨ ׳�׳™׳§׳•׳� ׳”׳“׳£ ׳‘׳™׳� ׳”׳“׳₪׳™׳�") even in the source code, and only...
0
7915
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.