Problem with character encoding?
I have a webpage containing a textarea. Users can enter some text or update existing text in the textarea and hit the save button. On submit the value of the text area is sent to a bean and then written to an Oracle 10g database. The page is then refreshed and the newly updated data is shown in the textarea.
The problem is that users sometimes enter the trademark symbol into the textarea. They do this by entering ™ which is the correct way of doing this. This is saved to the database ok. When the page refreshes the textarea displays the trademark symbol instead of ™ This is not a problem. However any subsequent editing and saving of the textarea fails. Looking at the data in the bean (from the textarea) the trademark is show as a (?) in the string. When saving this to the database this error occurs:
java.sql.SQLException: Cannot map Unicode to Oracle character.
If i change the trademark symbol to ™ it saves to the database fine. When the page is refreshed it displays the trademark symbol instead of ™ and will no longer save to the database.
Phew! hope that is clear!
So it's like if you had, I dunno, say a discussion forum site, and people could use HTML escapes to include special characters in their posts, but if someone quoted the original post in their reply, they would see in the textarea the actual character instead of the escape sequence that the original poster used? I can see how you would want to fix that right away, because it would make it look like your site was being run by a bunch of apathetic morons. But if you don't feel like exercising your brain that much, you can just add a bunch of bells and whistles that nobody asked for, like smilies and html formatting (in the subject line as well as the message body). If that doesn't work, introduce a system where people can assign stars to posters who give good answers. That will make your users forget all about your site's little technical glitches, guaranteed.
Similar Messages
-
Problem with character code NCR (example : cộng h�a x� hội)
Dear
I have problem with character code NCR when display this string "cộng h�a x� hội" on web page using JSF. I print out like this c & # 7897 ; ng h � a x � h & # 7897 ; i
Thanks for helpjverd wrote:
A better approach would be to take a char rather than a String in that method, since it's a better model for what you're converting. A char would also let you use switch statement.I was going to say this as well but you beat me to it.
@OP, you really should use char for this. You're unnecessarily taking each char, converting it to a string, and working with the single-character string. That's not very efficient. -
Problems with string encoding - need the text content in char* format.
The problem is non ASCII-characters, which comes out as some sort of unicode I need to desipher.
Here's what I got:
A text frame object with the TextString "Agnartjørna"
I get the text content of this object into an ai::UnicodeString the following way:
AIErr
VMGetTextOfTextArt( AIArtHandle textArt, ai::UnicodeString &ucStr)
ASUnicode *textBuffer = NULL;
AITRY {
TextFrameRef ateTextRef;
AIX( sAITextFrame->GetATETextFrame( textArt, &ateTextRef));
ATE::ITextFrame ateText( ateTextRef);
ATE::ITextRange ateRange = ateText.GetTextRange( true);
ASInt32 textLen = ateRange.GetSize();
AIX( sSPBlocks->AllocateBlock( (textLen+2) * sizeof( ASUnicode), nil, (void**) &textBuffer));
ateRange.GetContents( textBuffer, (ASInt32) textLen+1);
/* trim off trailing newlines */
if ((textBuffer[textLen] == '\n') || (textBuffer[textLen] == '\r'))
textBuffer[textLen] = 0;
ucStr.clear();
ucStr.append( ai::UnicodeString( textBuffer, textLen));
sSPBlocks->FreeBlock( textBuffer);
textBuffer = NULL;
AIRETURN;
AICATCH {
if (textBuffer) sSPBlocks->FreeBlock( textBuffer);
AIPROPAGATE;
Now, the next step is to convert it into a form that I can use to call regexp.
Baiscally, I want to detect the ending "tjørna" (meaning small lake) on a map label, and apply a standard abbevriation "tj^a" (with "a" superscripted).
So the problem is to obtain the regexp pattern and the text content in same encoding. And since the regexp library is old *char based, I would like to convert the text content in to plain old *char.
Hence the following code:
static AIErr
VMAbbreviateTextArt( AIArtHandle textArt,
vmTextAbbrevEffectParams *params)
AITRY {
/* first obtain the text contents of the textArt */
ai::UnicodeString ucText;
const int kTextLen = 256;
char textContent[kTextLen];
AIX( VMGetTextOfTextArt( textArt, ucText));
ucText.as_Roman( textContent, kTextLen);
But textContent now has the value "Agnartj\xbfnna" (According to XCode),
which will not get a match on the pattern "tj([øe][rn])na\\" (with backslash matching the end of the string)
Any other ways to convert the textContent to a plain *char string?Thank you very much, your method will work fine. with
the "UTF-8" parameter the byte[].length is double,
cause every valid byte is preceeded by an -62, but I
will just filter the valid bytes into a new array.
Thanks again,
StefanActually what you need to do is to find the character encoding that your device expects, and then you can code your strings in Arabic.
That's the way Java does things; Strings and char values are always in UNICODE (see www.unicode.org) (which means \u600 to \u6ff for arabic) and uses a specified character encoding when translating these to and from a byte stream.
Each national character encoding has a name. Most of them are identical to ASCII for 0-127 and code their national characters in 128-255.
Find the encoding name for your display and, odds are, the JRE has it in the library.
BTW the character encoding ISO-8859-1 simply maps UNICODE characters 0-255 on to bytes. -
Problem with '&' character in xml
Hello!
i work with XI3.0 sp19
i have a interface ftp ->XI-> idoc.
ftp adapter send a xml file.
I solve all problems with special characters using encoding="ISO-8859-9", but i have problem when in my message there are a '&' character.
any idea?????This has been discussed lately:
Ampersand ('&') in XML - Mapping error
Regards
Stefan -
HTTPService + SimpleEmailForm - Problem with character
Problem with swedish character å, ä och ö in a
simple form mail with flex, php and mySQL.
Have tried to change this in flex - mySimpleFormMail.mxml:
<?xml version="1.0" encoding="utf-8"?> to
<?xml version="1.0" encoding="Latin1"?> and to
<?xml version="1.0" encoding="iso-8859-1"?>
Have also at the same time changed this in mail.php:
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" /> to
<meta http-equiv="Content-Type" content="text/html;
charset=Latin1" /> and to
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
The mySimpleFormail looks like this is this:
From---------------------------------------
Name----------------------------------------
To------------------------------------------
E-mail---------------------------------------
Mesage---------------------------------------
SEND (button)
The e-mail generated from mySimpleFormail looks like this:
From: Patrik Hällman
Email Address: [email protected]
To:
Patrik Hällman
Email Address: [email protected]
Message:Now I´m testing with the swedish character -
åä och ö.
...as you can see swedish character å, ä och ö
is wrong displayed.
Here is the result from <traceTarget>:
[SWF] C:\AppServ\www\email \bin-debug\email_send4.swf - 910
229 bytes after decompression
'AB8F6784-15FC-7BD4-D26D-F73192A7717F' producer set
destination to 'DefaultHTTP'.
'direct_http_channel' channel endpoint set to http:
'AB8F6784-15FC-7BD4-D26D-F73192A7717F' producer sending
message 'AA84F829-98F0-E93F-D7AC-F732847CF6B2'
'direct_http_channel' channel sending message:
(mx.messaging.messages::HTTPRequestMessage)#0
body = (Object)#1
emailMessage = "Now I´m testing with the swedish
character å, ä and ö."
senderEmail = "[email protected]"
senderName = "Patrik Hällman"
sendToEmail = "[email protected]"
sendToName = "Patrik Hällman"
clientId = (null)
contentType = "application/x-www-form-urlencoded"
destination = "DefaultHTTP"
headers = (Object)#2
httpHeaders = (Object)#3
messageId = "AA84F829-98F0-E93F-D7AC-F732847CF6B2"
method = "POST"
recordHeaders = false
timestamp = 0
timeToLive = 0
url = "
http://www.myhomesite.se/email/email.php"
'AB8F6784-15FC-7BD4-D26D-F73192A7717F' producer connected.
'AB8F6784-15FC-7BD4-D26D-F73192A7717F' producer acknowledge
of 'AA84F829-98F0-E93F-D7AC-F732847CF6B2'.
Decoding HTTPService response
Processing HTTPService response message:
(mx.messaging.messages::AcknowledgeMessage)#0
body = "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
clientId = "DirectHTTPChannel0"
correlationId = "AA84F829-98F0-E93F-D7AC-F732847CF6B2"
destination = ""
headers = (Object)#1
messageId = "5624FC90-E89E-2B47-92B9-F7328A8CB993"
timestamp = 0
timeToLive = 0
This is catastrophic when you working with cms and databases.
All help I can get from this forum is really appreciated.Well, using UNICODE for upload/download files I think is most suitable way. If in AL11 you don't see it being displayed correctly (odd characters appear), that doesn't necessary mean it has wrong encoding set. Maybe AL11 is using different decoding type by default. Normally storage of file on AS is not its final destination, right? You place it there i.e. for customer's job to read it back and send via email. So just make sure that downloading program uses same decoding you used for encoding (UTF-8). Then the characters in the output stream (i.e. frontend file, mail body) should be displayed correctly
What I mean is don't worry how it is dispalyed in AL11, just ensure that after you download it, the characters are correctly decoded.
PS: Make sure that you metion encoding type explicitly both for upload and download programs
OPEN DATASET dset .... IN TEXT MODE ENCODING/DECODING UTF-8.
Regards
Marcin -
Problem with URL encoding conversion
Hi all,
I am working on an I18N application and in my application one component sends the request to another component and then this component fetch that requet and extract the query-parameters from the request (HTTP request).
Now the problem is that the input to first component can be given in one of the 5 character encodings:-
UTF-8
Shift_JIS
EUC_JP
Windows-31J
ISO-2022-JP
I have created a test program that convert the encoded URL from one character encoding to another character encoding. It is working successfully for the above 4 encodings but for the last encoding that is "ISO-2022-JP" this fails. The test programs is: -
import java.io.*;
import java.util.*;
import java.net.URLDecoder;
import java.net.URLEncoder;
class JPtoUTF8{
public static void main(String[] args){
try{
String shift_jis = "%82%C8%82%A4%82%8B%82%E8"; // This is Shift_JIS encoded URL
String iso2022jp = "%1B%24B%24J%24%26%23k%24j%1B%28B"; // This is ISO-2022-JP encoded URL
String utf8 = "%E3%81%AA%E3%81%86%EF%BD%8B%E3%82%8A"; // This is the result that should be obtained
String decodedShift_jis = URLDecoder.decode(shift_jis,"Shift_JIS");
String decodedIso2022jp = URLDecoder.decode(iso2022jp,"ISO-2022-JP");
String encodedShift_JIS = URLEncoder.encode(decodedShift_jis,"UTF-8");
String encodedIso2022jp = URLEncoder.encode(decodedIso2022jp,"UTF-8");
System.out.println("shift_jis = "+shift_jis);
System.out.println("encodedShift_JIS = "+encodedShift_JIS);
System.out.println("iso2022jp = "+iso2022jp);
System.out.println("encodedIso2022jp = "+encodedIso2022jp);
}catch(Exception e){
e.printStackTrace();
}I am using jdk5 for this application.
Please give your valuable suggestions.
Thanks in advance.Could the cause be that ISO-2022-JP is not just ISO-2022-JP:
http://www.w3.org/TR/japanese-xml/#AEN28427904
Maybe what you are getting is one of the flavors, while the java urldecoder uses another flavor? Or maybe the string you are getting is incorrectly encoded to being with (might have been incorrectly converted from shift-jis)?
With the shift-in shift-out design it is a difficult encoding to deal with under the best of circumstances, so you have my sympathy. -
Problem with file.encoding in Linux
Hello,
I am currently migrating a java project from Windows to Linux. The project is finally shaping up now, except for some encoding problems.
All configuration files are saved in ISO-8859-1/Cp1252 format. When reading and displaying these files in Swing (e.g. JTextArea), the special characters ���� are displayed wrong. I have tried to start the VM with -Dfile.encoding=ISO-8859-1 and -Dfile.encoding=Cp1252 without success (this is done in Eclipse under Linux).
I then tried the opposite. I created some UTF-8 files, started the application under Windows/Eclipse, read the files and displayed them in a JTextArea. Garbage characters were shown instead of ���� (as expected). I then used -Dfile.encoding=UTF-8, and voila, all characters were displayed correctly.
Why does not -Dfile.encoding work for ISO-8859-1/Linux but -Dfile.encoding work for UTF-8/Windows? Anyone here know?
The JRE I have been using is 1.4.2_06.
The Linux is a SuSE 10.0Continue the "discussion" here:
http://forum.java.sun.com/thread.jspa?threadID=737153 -
Having a problem with character styles in indesign
I'm having another problem with my style sheets in indesign, I've now got an awful lot of styles in paragraph and character styles. I've created different styles for paragraph justified text and when I go to my style in paragraph styles to use tight text copy, character styles always overides it so it means I have to do whole lot of extra formatting just to put it right. Does anyone have an idea how I can stop character styles overiding paragraph styles? Thanks very much.
Perhaps your character styles apply more than you actually want? I.e., rather than just "+Italic" it also applies custom tracking. You should use character styles only to override the stuff you really want to change.
You can check by calling up the definition for those character styles; the huge "Style Settings" text box lists all the attributes it changes. -
I use iSQL
I used database with character AR8MSWIN1256 its correctly
but I use database with character AR8ISO8859P6 the data it not correct
thanksWell, using UNICODE for upload/download files I think is most suitable way. If in AL11 you don't see it being displayed correctly (odd characters appear), that doesn't necessary mean it has wrong encoding set. Maybe AL11 is using different decoding type by default. Normally storage of file on AS is not its final destination, right? You place it there i.e. for customer's job to read it back and send via email. So just make sure that downloading program uses same decoding you used for encoding (UTF-8). Then the characters in the output stream (i.e. frontend file, mail body) should be displayed correctly
What I mean is don't worry how it is dispalyed in AL11, just ensure that after you download it, the characters are correctly decoded.
PS: Make sure that you metion encoding type explicitly both for upload and download programs
OPEN DATASET dset .... IN TEXT MODE ENCODING/DECODING UTF-8.
Regards
Marcin -
Problem with RPC/encoded WSDL
I'm having trouble calling a web service that is based on an RPC-encoded WSDL. I've already made slight changes to the WSDL, so that I get a work-able message type for mapping purposes. These changes are based on <a href="http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16556272"><b>soapenc:Array</b> recommendations in WSDL 1.1 Section 2.2</a> for declaration of array types.
Here's a snippet of the WSDL:
<wsdl:definitions ...>
<wsdl:types>
<schema ...>
<complexType name="ArrayOf_tns1_ServiceOption">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="tns1:ServiceOption[]"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
</restriction>
</complexContent>
</complexType>
</schema>
<schema ...>
<complexType name="ServiceOption">
<sequence>
<element name="key" nillable="true"
type="xsd:string"/>
<element name="value" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
</wsdl:definitions>
I've changed it to:
<wsdl:definitions ...>
<wsdl:types>
<schema ...>
<complexType name="ArrayOf_tns1_ServiceOption">
<sequence>
<element name="ServiceOption"
type="tns1:ServiceOption"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</schema>
</schema>
<schema ...>
<complexType name="ServiceOption">
<sequence>
<element name="key" nillable="true"
type="xsd:string"/>
<element name="value" nillable="true"
type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
</wsdl:definitions>
The above changes have allowed me to make message mappings. But the I still get an error when sending a request to the web service. It seems that it requires the <b>xsi:type</b> and <b>soapenc:arrayType</b> attributes for arrays.
<b>How can I create these attributes? How does XI handle RPC-encoded WSDLs?</b> I haven't encountered these problems with document-literal WSDLs.
Thanks in advance.Hi Lorenzo,
the extended support of rpc-style does <b>not</b> include the support of soapenc:array. It just addresses the root of the message and its direct children (as discussed in the thread where I added this hint).
In the documentation of External Definitions you can find a hint where to find a list of supported XSD/DTD/WSDL-features. However, also there you will find no hint on the fact that soapenc:array is not supported. The reason for this is, that soapenc:array is specified in none of these standards. It is some artifact that SOAP smuggled into XSD. For good reasons WS-I prohibits the use of this artifact.
Hence, if you need support for argumentation I can only point out the WS-I document I already linked.
Greetings
Stephan -
Problem with character set - Reports 11.1.1.4
Hi!
I have a problem with Oracle Reports 11g regarding character set configuration. The default character set WE8ISO8859P1 works, so PDF reports have a regular display except for Eastern European (EE) letters which are replaced by "¿" sign.
So, when I set any other character set in reports.sh, which would be a normal step to get EE letters, I'm always getting Greek Alphabet in PDF reports. Why Greek Alphabet?
The character sets I tried to use are: EE8ISO8859P2, UTF8 and AL32UTF8.
I changed uifont.ali and included PDF Subset with all four Arial font variants and, of course, I placed all fonts in fonts folder which is pointed by REPORTS_FONT_DIRECTORY.
In Reports Builder everything works fine, but when I have to deploy the report to the Reports Services, the problem occurs.
Also, when I've tried to execute PDF report using In-Process Reports Server (rep_wls_reports_hostnameasinst1) instead of AS Instance Reports Server (RptSvr_hostnameasinst1, which is a regular server), I'm getting Greek Alphabet in PDF reports even if the default character set is WE8ISO8859P1 in reports.sh. What is wrong with it? Where is Greek Alphabet configured?
The production environment is 64-bit Oracle Linux 5.6 with Weblogic 10.3.4 and Forms&Reports 11.1.1.4. Forms works fine with character set EE8ISO8859P2 defined in default.env file.
Thanks in advance!
Regards,
DejanThank you, Denis!
Doc 300416.1 was very useful but Note 356221.1 - A Practical Methodology on Porting Reports from Windows to Unix with Different Font is actually crucial for configuring Reports on Linux.
Also, there is a bug in 11.1.1.3 and 11.1.1.4, which can be fixed using the patch ( Note 1138405.1 - PDF Reports With Font Subsetting Raises Error "Bad /Bbox" on 64-Bit Linux ).
Kind regards! -
Problems with H264 encoding -- corrupted files...
In Media Encoder CS5 I tried to export my Premiere Pro CS5 sequence with H264 encoding(30 fps, progressive, CBR 6 mbps, 640 x 480). Audio(AAC, 48 kHz, 256 kbps). It have made a corrupt video file(with 2 GB size, and it should be ~3,5 GB). I tried to re-export with these settings, and now the size was 1045 MB. Again corrupted file, it cannot be played... The Media Encoder says that there is no errors, the rendering was successful. After several other tries with different settings, I cannot render my movie.
What can I do?
Thanks for help!
DaninetHello all,
This is an old thread, but it's an old problem that I'm concerned may still be continuing.
We're moving from 3.2 to 4.1. While copying our applications from 3.2 to a test 4.1 installation, we did a static file export for "All static files" from 3.2 and did an import to 4.1. We're seeing the same behavior that I and others have reported in the past - any static files that are javascript are corrupted when "all static files" was chosen. Exporting/importing each javascript static file individually appears to work fine.
If the bug was in 3.2 in that it was generating a corrupted export file when "all static files" is chosen, then I'm not concerned - we're moving from 3.2 anyway. But, if the issue is in the import then it must still exist in 4.1 and that would be a concern.
Does anyone know if this was a recognized bug in 3.2 and has since been corrected?
Thanks!
John -
I'm making photo album on the web. But I have a problem with thumbnails generation. I have read alot about it on this forum (thanks guys) but I have a problem:
Sometimes (but not every time) and independent on the image I've got thumbnail picture that can not be readed neither by IE or Photoshop or another programm. I'm using next encoding sequence:
PEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
com.sun.image.codec.jpeg.JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bufferedImage);
writeParam.setCompressionMode(JPEGImageWriteParam.MODE_EXPLICIT);
param.setQuality(0.7f, true);
encoder.setJPEGEncodeParam(param);
encoder.encode(bufferedImage);
And this code operate in the Servlet enviroment. So, I can not understand what is wrong?
Renat.Hi Renat.
I may be wrong but I have observed some troubles with JPEG encoding (particularly because of a lack of CPU)... You may have the same trouble... The problem is that I don't how to catch these errors but if someone knows how to, I would be really interested in... I can only catch them when I decode these images thanks to TruncatedFileException and ImageFormatException.
Stephane. -
Problem with character set UTF-16 LE
Hello.
There were difficulties with character set change, using function convert ()
The matter is that in the list v$nls_valid_values the character set AL16UTF16LE does not appear, during too time the inquiry is successfully carried out
convert ([some-national-characters], ' CL8MSWIN1251 ', ' AL16UTF16LE ').
But at giving on an input of the data stored in CLOB, there is an error "a character set is not supported"
What are possible ways of the decision of a problem?You can try to use DBMS_LOB. SUBSTR to access LOB data like in the following example:
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
SQL> declare
2 v_i clob;
3 v_o clob;
4 begin
5 v_i := 'a';
6 v_o:=convert(dbms_lob.substr(v_i,1,1),'AL16UTF16LE', 'CL8MSWIN1251');
7 end;
8 /
PL/SQL procedure successfully completed. -
Hi,
I am facing some problems with Oracle character sets.
I have set the database character set as UTF8.
I have set the environment variable NLS_CHAR to Portuguese_Portugal.UTF8.
I insert a Portuguese text for varchar and clob columns in a table.
However when I select the text from that table, I get some junk values for the clob.
Any help is appriciated. Thanx in advance.
Yash
nullHi Yash,
Can u tell me how to insert values in a nchar/nvarchar column in
Indian language scripts?
I have set database characterset to 'IN8ISCII'? But while
inserting values in the table I am getting error as characterset
mismatch'
I have tried it using UTF8 chracterset also??
As fa as your problem is concerened, I think u have to set the
nls_ characterset value$ in props$ table
and same for nls_nchar_characterset column also..
Thanks in advance
Manoj mehta
Maybe you are looking for
-
Photoshop Elements 6.0 using Windows Live
I, too, keep receiving the error message that no email is associated with this program... I'm running Windows 7 and use Windows Live mail as my default... Are there any drivers to update? Any ideas? Thanks. Message was edited by: mylifeisahoot
-
How can I use the YouView remote to switch HDMI in...
I have the latest style YouView remote with the large YouView and BT Vision buttons. It's programmed to my control my Sony TV, with channel up/down, volume up/down and power on/off working fine. But there's no button that switches between HDMI inputs
-
Download/Upload ABAP Programs, screens, texts, etc
Hi Experts, Is there any standard program or any tool by which we can download/ upload ABAP programs, sapscripts, Screens, text-elements, Webdynpro for ABAP applications to a local file???? The Download to local server option in SE38 just gives a tex
-
Thank you
-
Hi, I connected my iphone to the PC and was able to see the iphone icon. However when clicking on the icon I get an empty folder and am unable to see any pictures. How do I resolve this?