Problem with Accent and Resource File (bis)

F

Fabrice

Hello,
(Alain)

Tis is a part of my code to retrieve text from hastable in memory cache, by
reading (befor) a resources file.
Thanks for your help.

/1/ The resources file

* I have create a .TXT file with Keys/Values

Exemple of values :

lblPageLocation=Page d'accueil.
btn002Logoff=Déconnexion
.....

* so, i have generated resources file whith this command :

resgen form.aspx.txt form.aspx.resources


2/ Reading of the resources file.
After the first reading, i set all Keys/Values in a hashtable. The hashtable
is set in cache memore for best performance.

* To use my file, i use ResourceReader Class :
This is a part of my code of my personal Class named MyResxManager

...
Private Shared myRR As ResourceReader = Nothing
....

'Reading of Resource File / Insert into Cache Memory
myRR = New ResourceReader(myKeyFormPath & myKeyFormName)

Dim mydEntry As DictionaryEntry 'Dictionary key-and-value pair that can
set/retrieved
Dim myHT As Hashtable = New Hashtable() 'Initialisation HashTable

'Iterate through the reader, get out the name-value pairs
For Each mydEntry in myRR
myHT.Add(mydEntry.Key,mydEntry.Value)
Next mydEntry

'Close the reader
myRR.Close()
mydEntry=Nothing

'Add to Cache - Relative Expiration & CacheDepency
Dim tspP4TimeOut As System.TimeSpan = New System.TimeSpan(0,0,1,0)
'Objet Timespan = 1 minutes
System.Web.HttpContext.Current.Cache.Insert(KeyForm, myHT, _
New CacheDependency(myKeyFormPath & myKeyFormName),
System.DateTime.MaxValue, tspP4TimeOut)

'Nothing Hastable
myHT = nothing


3/Reading value from Hastable in memory cache to get the "Text value" of my
control.

In my .aspx page i call my function by passing Name Control and Name
Hashtable.

********** For retrieved text iin code behind.

** COntrol Label Case

lblPageLocation.text =
myLocalization.EasyResourceManager.myGetString("lblPageLocation","form.aspx")

lblPageLocation = Name of label control
myLocalization = Name of my NameSpace
EasyResourceManager = NAme of my class
myGetString = Name of my public shared function

With a label control i haven't got any problem. The accent is well
displayed.
i get the word : déconnexion

** Control Button Case

btn002Logoff.Text =
myLocalization.EasyResourceManager.myGetString("btn002Logoff","form.aspx")

Here, all is wrong i get the value :

Déconnexion and not : déconnexion



************** First message

Hello,

I have encountered a deep problem with accent and I don't understand why.
I m preparing a multi-language website. French and English so far.

With french, we have accents and ... problems ;-)
The internationalisation of my website works like that :

- I have created a resources file for a language (french for example) by
using Resgen Command.
- I read the resources file and get the diffrents texts for my controls :
Label, Button, Image ...
Everything works fine but not Text with accent for button control.

I have replaced accent by code as é by é

Example of a resources file :

Control1=FirstText
Control2=SecondText

... and for accent
Control3=Déconnexion

--> é is going to give the sign é

Result :

I have no problem with label control or literal. The right word is dispayed.
But the same variable for a Button control gives me something wrong!

The text displayed for my button is :

Déconnexion and not the text " déconnexion "

By regarding the HTML source i have :

for the Label Control : Déconnexion (is right and displayed "
déconnexion")
for the input control i have value="Déconnexion" ... it's strange !

If someone can help me...
thanks a lot
fabrice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top