convert between utf8 and we8mswin1252 does not work properly

Hello

When debugging an application, I wonder about the conversion SQL function. Then do some tests with accents.

* 1. Test with u * (UTF8 = 0xc3bc = 50108, Win-1252 = 0xFC = 252):
Select ascii (convert (chr (50108), 'WE8MSWIN1252', 'UTF8')) double;
Result = 252
== > Everything is OK. That's what I proposed.

* 2. Test with a * (UTF8 = 0xc3a4 = 50084, Win-1252 = 0xE4 228 =):
Select ascii (convert (chr (50084), 'WE8MSWIN1252', 'UTF8')) double;
Result = 0
== > What is? I suggested 228?

I tested two server Oracle (lokal 10.2.0.2 with UTF8 and apex.oracle.com) with the same result.
Can someone explain this behavior?

Yes, I can. The problem is to try using ASCII() in a UTF8 database to get a binary code in a string to WE8MSWIN1252. You must understand that the CONVERT function is should not be used for normal operation in the database. The channels it produces are VARCHAR2 and VARCHAR2 should always be in the database character set. If the CONVERSION target character set is not the database character set, the returned string is generally not valid (even if it contains a reasonable sequence of bytes in a character set) and may not be used in other SQL functions. CONVERT is a feature inherited from Oracle6 and must be used for the tasks of repair special only.

It happens that ASCII('[0xFC]') returns the correct result because 0xFC is not a valid in UTF8 code and happens to be interpreted "as-is" of the current implementation of ASCII, while ASCII('[0xE4']') does not return anything because the database recognizes the 0xE4 as the first byte of a UTF-8 of 3 bytes code and returns 0 failing to have the two remaining bytes. That's generally what docs call 'undefined results.

The path is valid only for watching the result of the CONVERSION would be to use the DUMP function.

-Sergiusz

Tags: Database

Similar Questions

Maybe you are looking for

  • Where to find connectors for map plugin SMU

    Can anyone help with information on the XP4/XJ4 connectors for SMU: numbers of appropriate provider type? We want to make a personalized card to plug into a chassis SMU-1071 - but only a need the 3.3V power supply to the chassis. But after a long sea

  • I have a Sony HDR - HC3 HDV and want to download only the parts of a video

    I have been using a Sony HDR - HC3 Handycam HDV1080i VCR for many years and have been able to download parts of a video on the part of the band whenever I wanted to.  The camera recently died and I replaced it with an exact version that I still had t

  • How to fix 'runtime error 364.

    Difficulties running a Linksys Router installation CD, get "run-time error 364.  How can I fix it... a program or utility that will solve the problem?  Running XP Professional.

  • How to download photos of ancestry

    I downloaded some pictures of my ancestors by clicking on the picture when I see... Some are in folders and I'm having a hard time their location. You can Give me an easier way to download the photos? Thank you very much, Jimi

  • How to configure in the apex using other engine of transformation XSL - FO instead of Bi publisher

    can someone give me a quite complete example for me on the engine configuration of processing XSL - FO in the Apex.I'm feeling rather puzzled about the example set by the introduction of the link:http://www.oracle.com/technetwork/developer-tools/apex