I'm working on a client/server app that seems to work fine in OS Firefox and
Windows IE and Firefox.
However, in OS X Safari, although the UI/communications themselves work
fine, if the characters getting sent back and forth are in Japanese they
come back from the server "moji bake" (corrupted).
Anybody have any ideas why this might work differently in Safari than in
Firefox or IE?
Thanks!
doug 21 2500
Doug Lerner wrote: However, in OS X Safari, although the UI/communications themselves work fine, if the characters getting sent back and forth are in Japanese they come back from the server "moji bake" (corrupted).
Consider to use UTF-8 encoded Unicode characters and make sure the
server sends a HTTP header declaring e.g.
Content-Type: application/xml; charset=UTF-8
or if you send plain text then e.g.
Content-Type: text/plain; charset=UTF-8
I assume you use XMLHttpRequest to send and receive data, with the above
both responseXML or responseText should hopefully work correctly
(although I am not familiar with details of the Safari implementation) .
--
Martin Honnen http://JavaScript.FAQTs.com/
On 1/18/06 10:05 PM, in article
43************* **********@news read2.arcor-online.net, "Martin Honnen"
<ma*******@yaho o.de> wrote: Doug Lerner wrote:
However, in OS X Safari, although the UI/communications themselves work fine, if the characters getting sent back and forth are in Japanese they come back from the server "moji bake" (corrupted).
Consider to use UTF-8 encoded Unicode characters and make sure the server sends a HTTP header declaring e.g. Content-Type: application/xml; charset=UTF-8 or if you send plain text then e.g. Content-Type: text/plain; charset=UTF-8 I assume you use XMLHttpRequest to send and receive data, with the above both responseXML or responseText should hopefully work correctly (although I am not familiar with details of the Safari implementation) .
Thanks for your response.
In my case, the return data is not being used to replace an entire HTML
page, it is being used to set the innerHTML for a <div> tag. So sending the
HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
Any thoughts about this?
Thanks!
doug
Doug Lerner wrote: On 1/18/06 10:05 PM, in article 43************* **********@news read2.arcor-online.net, "Martin Honnen" <ma*******@yaho o.de> wrote:
Doug Lerner wrote:
However, in OS X Safari, although the UI/communications themselves work fine, if the characters getting sent back and forth are in Japanese they come back from the server "moji bake" (corrupted).
Consider to use UTF-8 encoded Unicode characters and make sure the server sends a HTTP header declaring e.g. Content-Type: application/xml; charset=UTF-8 or if you send plain text then e.g. Content-Type: text/plain; charset=UTF-8 I assume you use XMLHttpRequest to send and receive data, with the above both responseXML or responseText should hopefully work correctly (although I am not familiar with details of the Safari implementation) .
Thanks for your response.
In my case, the return data is not being used to replace an entire HTML page, it is being used to set the innerHTML for a <div> tag. So sending the HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
Any thoughts about this?
AFAIK browser page is a "single encoding" unit therefore you cannot
display one paragraph in iso-8859-1 and another in say Shift_JIS. This
is why Unicode became originally needed. Did you try to have the entire
page served in UTF-8 including any further server interchange?
Doug Lerner wrote: In my case, the return data is not being used to replace an entire HTML page, it is being used to set the innerHTML for a <div> tag. So sending the HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
If you use XMLHttpRequest and the responseText property then the client
receiving the response needs to know the charset/encoding of the
response to build responseText correctly. At least in theory, MSXML used
by IE does not care about HTTP headers when building responseText and
assumes UTF-8 so that is why I suggested to use UTF-8 and to make that
known with the HTTP header as that way MSXML and Mozilla and Opera and
hopefully Safari should then give you responseText with any characters
Unicode can encode, be that Japanese or whatever else.
--
Martin Honnen http://JavaScript.FAQTs.com/
On 1/19/06 6:15 PM, in article 11************* *********@g47g2 00...legr oups.com, "VK"
<sc**********@y ahoo.com> wrote: Thanks for your response.
In my case, the return data is not being used to replace an entire HTML page, it is being used to set the innerHTML for a <div> tag. So sending the HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
Any thoughts about this?
AFAIK browser page is a "single encoding" unit therefore you cannot display one paragraph in iso-8859-1 and another in say Shift_JIS. This is why Unicode became originally needed. Did you try to have the entire page served in UTF-8 including any further server interchange?
Yes, I tried that. Something just seems "different" about the way it is
working in Safari. With Firefox or IE, it seems to work fine, even with the
Shift_JIS charset.
But with Safari the Japanese seems to get corrupted. I think it *is* sending
it to the server in UTF-8. That is, if I log the received data on the server
side and examine it it appears to be UTF-8 data. But when I send it back to
the browser, even if the browser's charset is UTF-8 it shows up looking
corrupted.
doug
On 1/19/06 9:10 PM, in article
43************* **********@news read4.arcor-online.net, "Martin Honnen"
<ma*******@yaho o.de> wrote:
Doug Lerner wrote:
In my case, the return data is not being used to replace an entire HTML page, it is being used to set the innerHTML for a <div> tag. So sending the HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
If you use XMLHttpRequest and the responseText property then the client receiving the response needs to know the charset/encoding of the response to build responseText correctly. At least in theory, MSXML used by IE does not care about HTTP headers when building responseText and assumes UTF-8 so that is why I suggested to use UTF-8 and to make that known with the HTTP header as that way MSXML and Mozilla and Opera and hopefully Safari should then give you responseText with any characters Unicode can encode, be that Japanese or whatever else.
Thanks for your note. As mentioned in my note, the charset for the entire
page being served was correct. And I tried UTF-8 instead, but that didn't
seem to help.
It displays fine with all browsers except for Safari. I'm sort of stumped.
doug
Doug Lerner wrote: On 1/19/06 6:15 PM, in article 11************* *********@g47g2 00...legr oups.com, "VK" <sc**********@y ahoo.com> wrote:
Thanks for your response.
In my case, the return data is not being used to replace an entire HTML page, it is being used to set the innerHTML for a <div> tag. So sending the HTTP header wouldn't be appropriate in this case, would it?
The charset for the entire page itself is correct already.
Any thoughts about this?
AFAIK browser page is a "single encoding" unit therefore you cannot display one paragraph in iso-8859-1 and another in say Shift_JIS. This is why Unicode became originally needed. Did you try to have the entire page served in UTF-8 including any further server interchange?
Yes, I tried that. Something just seems "different" about the way it is working in Safari. With Firefox or IE, it seems to work fine, even with the Shift_JIS charset.
But with Safari the Japanese seems to get corrupted.
Corrupted in what way?
1) Latin ASCII chars ?
2) Unicode "missing gliph" chars ? (empty squares)
3) Japanese gliphs but not the needed one ?
Doug Lerner wrote: Thanks for your note. As mentioned in my note, the charset for the entire page being served was correct.
I am not sure I understand what an entire page is or why that matters or
what you are doing exactly, no wonder as you have not posted any code so
far.
If you serve one HTML document with script and that script makes further
requests to the server using XMLHttpRequest then the server needs to
make sure it sends proper HTTP response headers (with Content-Type and
charset parameter) in its response to any request the script makes if
the browser's XMLHttpRequest implementation should have a chance to
build responseText properly. It does not matter if you do not consider
or indeed such a response is not a complete HTML document but if a HTTP
response is processed then to build a responseText string you need to
know the charset to properly decode the bytes in the response body into
the responseText string.
--
Martin Honnen http://JavaScript.FAQTs.com/
VK wrote: AFAIK browser page is a "single encoding" unit
True.
therefore you cannot display one paragraph in iso-8859-1 and another in say Shift_JIS.
False. Character references and character entity references are there ever
since to workaround this issue. For example, it is perfectly reasonable,
possible and Valid to use the hexadecimal byte sequence 26 23 38 32 31 31
3B 0A, this represents the decimal character reference `–', for
displaying the Unicode character named "EN DASH" (U+2013) in a HTML
resource encoded with ISO-8859-1 and served as such. In fact, the same
byte sequence could _not_ result in that character reference if the
resource was encoded with a UTF and served as such.
This is why Unicode became originally needed.
Not quite. The reason for creating the Unicode standard and subsequently
the Unicode character set was that _one_ standard and _one_ character set
for all characters was needed, so that one encoding would suffice for all
characters and all textual resources, not only SGML-conforming ones such
as HTML documents, and that the latter then could contain the characters
as they are, without any character reference or character entity reference
which would save bandwidth and disk space.
Did you try to have the entire page served in UTF-8 including any further server interchange?
The encoding of an SGML-conforming markup resource, that is, how the
character data of a resource is encoded, does not have any impact on
the characters that can be displayed with it, that is, what character
sets can be used to display that data.
Despite its name, the "charset" label of the HTTP Content-Type header
specifies the _encoding_ of the served resource, not necessarily the
character set(s) that is/are to be used to display it; the confusing
name of the label is because of the history of MIME to which HTTP had
to adhere.
HTH
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel |
last post by:
I'm trying to make a site work for japanese characters. It works fine
except for the alerts in javascript.
The characters are stored in unicode, as this;
'コミック全巻配'
Those unicode characters are translated by the browser, but not in the
alert.
|
by: jemptymethod |
last post by:
http://htmatters.net/htm/1/2006/01/EIBTI-for-Javascript-explicit-is-better-than-implicit.cfm
|
by: petermichaux |
last post by:
Hi,
I've been reading the recent posts and older archives of
comp.lang.javascript and am surprised by the sentiments expressed about
the prototype.js library for a few reasons:
1) The library has been referred to as "junk" many times which is a
strong opinion against the relatively high popularity of the library. I
know popularity doesn't make something good.
|
by: petermichaux |
last post by:
Hi,
It seems like determining element position in a web page is a difficult
task. In the position reporting source code I've looked at there are
special fixes for at least some versions of Safari and Opera. I am
doing a lot of dragdrop experimentation and in some situations need a
position reporting function. The function doesn't need to report the
positions of exotic elements like images in button elements; however, I
would like a...
|
by: gg9h0st |
last post by:
function aa() {};
var bb = new aa();
var dd = new function cc() {};
aa.prototype.rr = 100;
cc.prototype.rr = 100;
---------------------------------------------------------------
| |
by: DL |
last post by:
Hi,
Our school has an application in which :
- Teachers enter comments through a web interface built in asp (not
asp.net).
- Comments are stored in a SQL server 2000 (in a nText field)
- Comments are printed through a MS-Access 2002 front-end...
Most comments are in English, Spanish or French. Some comments are
English + Japanese.
|
by: gregerly |
last post by:
Ok, I've got an ajaxed calendar that lets users add their own events. This works great in Firefox and IE. In Safari however, i'm getting errors as the response text, instead of the success or failure message. My javascript is below:
submitButton.onclick=function(){
//set up all neccessary variables
var screenname=$F('screenname');
var month=$F('month');
var day=$F('day');
var year=$F('year');
var...
|
by: liketofindoutwhy |
last post by:
I am learning more and more Prototype and Script.aculo.us and got the
Bungee book... and wonder if I should get some books on jQuery (jQuery
in Action, and Learning jQuery) and start learning about it too?
Once I saw a website comparing Prototype to Java and jQuery to Ruby...
but now that I read more and more about Prototype, it is said that
Prototype actually came from Ruby on Rails development and the creator
of Prototype created it...
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| | |