开发者

copy text (Indian language- GUjarati) from word document to web page text area

开发者_JS百科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.


You should set TextArea's font to Gopika.

<html xmlns="http://www.w3.org/1999/xhtml">
<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>


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 http://img8.imageshack.us/img8/5140/gujaratitest12768464518.png

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜