views:

198

answers:

3

Hi all,

I am developing one site in Indian language (Gujarati).

My problem is as below:

My client wants that they able to copy Gujarati text from word document and paste into the Text area.

But when i copy text from word doc and paste into text area the its get converted to the English letters.

http://www.chanakyanipothi.com/gujchanakya/Gopika.ttf

Above is the link of fonts which I am using.

I can provide you the demo code for you to make some work on it.

Is there any special thing which I am missing.

Hope I am clear to you. I am running in PHP and apache.

Thanks
Avinash

+4  A: 

You should set TextArea's font to Gopika.

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gopika Test</title>
<style>
textarea {
    font-family:"Gopika";
}
</style>
</head>
<body>
<form><textarea>asdasdioasd</textarea></form>
</body>
</html>
VOX
not working, any special way to do this???
Avinash
added code example, working fine in my firefox and safari.
VOX
i have created one HTML file with your code, but its displaying only English letters but it should display letters in Gujarati.
Avinash
let me know your OS and browser you are testing.
VOX
Windows 7 and FF 3.6.4Working in IE8, Safari, and chrome also.Only problem with FF 3.6.4
Avinash
@Avinash Sounds more like a problem with how FF implements copy/paste to me.
deceze
The font doesn't contain Indian characters, just English ASCII letters shaped like them, that's my theory.
thisMayhem
This will only SHOW English characters that look like Indian characters (getting tired of repeating this), any screenreader or css disabled user will still see English letters.
thisMayhem
The problem was the font itself. I fixed the font and download it here http://www.ihost-mm.net/GopikaFixed.ttf . I also renamed the font name to "GopikaFixed" change it in your CSS. For those who don't know what's happening and keep talking about ENGLISH ASCII characters, India use special kind of SCII called ISCII. :P I knew coz I am from Myanmar, we used same thing to display our language.
VOX
Please deal with license issues if there is any about your font, i'm not responsible. :)
VOX
@VOX open the character map, view both Gopika and.. Arial per say and see that those characters are indeed English.
thisMayhem
Yes, it is thisMayhem. And we use like that to display our language. :) I know it's kinda wired for you western guys. But they are there before Unicode and we keep using them. CharacterMap knows 65 is 'A' but it doesn't know there's another encoding that 65 is a Gujarati Character or even a Myanmar character. You're reading Gujarati from Wikipedia which is Unicode Gujarati (it'll work with all the things) not ISCII Gujarati that Avinash is having problem. The problem Avinash facing was that the font was created in Classic Macintosh era and FF doesn't read it well. I fixed the font.
VOX
@VOX how would that response to non English characters? What if the user wants to mix Indian and English character for whatever reason (movie title, band name, american girlfriend..) I understand that your method is an easier way of typing non-English languages but I don't agree it's a good idea to use that on web pages at all. btw you should update your answer to reflect the "GopicaFixed"
thisMayhem
with new fonts works in FF also...
Avinash
Yea, that's why we're moving forward to Unicode. We change font repeatedly in Word processors to use mixed languages. That's not Avinash's concerning. He's concerning the font didn't show up inside textarea. If he ask me how to use english and GopicaFixed in textarea, i'd answer "impossible" :)
VOX
@Avinash, please kindly mark my answer as your best answer ;)
VOX
yes sure, one question. how can i write Gujarati as well as some English words in text area????
Avinash
@Avinash That's my whole point! You cant.That's why you have to use Unicode, read my answer please
thisMayhem
You should be using Unicode Gujarati. So, it means the text you wrote in your word document must originally written with Unicode Gujarati not with your ISCII font. Otherwise, writing gujarati mixed with other languages in plain Text areas like text box, text area or notepad will not be possible. However it is possible in rich text areas such as Microsoft word by changing font when you want to write English.
VOX
That's why I wrote my answer, you don't always have to give a user what he wants. Sometimes it's better to give them what they need, even though they may not know what that is.
thisMayhem
@thisMayhem, dude! you don't know a bit about this thing to switch to Unicode. It is an answer yes, change to Unicode. But it's not that simple and easy. You can start writing Unicode text, how to do with the old data? Our conversation ends here as it's not related to the question anymore. I won't reply further.
VOX
Relax, it's not like I'm competing with you, I'm just trying to help. If switching to Unicode is not an option maybe he could consider some sort of basic markup to differentiate english text from gujarati and then parse it with php. Lets say.. show all in gujarati except text located inside `[eng][/eng]` tags, this text could be inserted in a span with a different font. That's a way of showing both. Down side still is that it will not show correctly on the textarea, but it will indeed be able to be shown on the comment list. Sorry if you took it as something personal, it was not my intend :S
thisMayhem
nono dude. I'm okay with you. Its just i don't want to flood our comments.
VOX
Oh okay, see you on some other question !
thisMayhem
+2  A: 

Unable to replicate, I can paste Indian ગુજરાતી on textareas without any apparent issue. The problem may be that you are not actually using Indian characters but English characters, or more probably that word is screwing you in some way.

I suggest you paste the code of the textarea here, and possibly upload the word file, or an example of a similar one (not like I'm going to understand it) so we can try to replicate the issues.

Update:

First test scenario, I pasted some text from wikipedia that included Indian, the text shown correctly on both the textarea and after posting. I assume you are doing some testing yourself for what I can see on the image: alt text

Second test scenario, I copied the text from the docx file and when pasted on the textarea, it appeared as english letters. Why? Because those are not Indian characters, they are English characters that look like Indian characters.

Meaning that even though they appear like Indian, they're still the same ascii codes underneath and when translated for the textarea, they lose their 'look'. You should try with some real Indian text.

For example, depending on the font you're using, the letter 'a' will look different and can in fact be a bird, a tree an Indian character or a motorcycle for all we care, but if copied and pasted somewhere that allows just plain text and not font-base text we will still see letter 'a', since it's always ASCII character 97. To test this yourself, go to your word document and press key ALT + 97 (then let go of ALT) you will by this in fact enter letter 'a' whether it looks like it or not.

Hope you understood. Real Indian, Chinese or whatever will work correctly, fonts that look like it wont unless you set the textarea's font to that particular font -.-

If that doesn't convince you, if you use the Cujarati font all characters that weren't in English, let's say a comment that was in fact quoting English would still be shown in the Cujarati font and therefore will make absolutely no sense at all.

Last but not least, open the character map, view the Cujarati map and then any other font's map. Then you can see that characters are in fact the same. But I give up on trying to convince those who don't want to see.

thisMayhem
http://xpertdeveloper.com/demo.docx here is the doc file i am using with Gopika fonts.and here is the link where is my text area.http://xpertdeveloper.com/demo2.php
Avinash
are you able to replicate the probelm???
Avinash
read my update!
thisMayhem
so what can i do with this??? Any demo for this???
Avinash
Read my last comment on VOX's answer, that's my last word on this question, it made me feel guilty for trying to help you. Sorry if my answer wasn't what you needed and good luck with your project.
thisMayhem
excellent.... but still textarea problem remains, any solution for this??
Avinash
As suggested by Vox you could use a Rich Editor or WYSIWYG that supports multiple fonts, then pasting should be simple. I suggest NicEdit, from http://nicedit.com There's a demo at http://nicedit.com/demos.php Make sure you add the new font to this editor or it will not be able to show the 'Indian' characters.
thisMayhem
good editor thx..I am in confusion for which ans to choose as accepted..Both area excellent...
Avinash
As long as I'm up voted I don't care Avinash, just choose him ;)
thisMayhem
great... if i do that without confirmation then i fill guilty..... Really thanks
Avinash
A: 

can u tell me how to make site in gujarati?where to add font to cpanel? answer me here and send [email protected]

sandeep