Hi,
I am looking for a function (or hint) how I can count unicode
characters (and not bytes) in DB2 V8.2.
In DB2 9 the length function is extenced with the codeunits32 option -
and this is exactly what I need in DB2 V8.2.
Can anybody help me with that?
Thanks in advance
kind regards
Michael 3 2524
globomike wrote:
I am looking for a function (or hint) how I can count unicode
characters (and not bytes) in DB2 V8.2.
In DB2 9 the length function is extenced with the codeunits32 option -
and this is exactly what I need in DB2 V8.2.
I would write a simple Java UDF that takes the string as input and counts
the number of characters. Something like this (completely untested) should
do:
import java.lang.*; // for String class
import COM.ibm.db2.app .UDF; // UDF classes
public class UnicodeCharCoun t extends UDF
{
public void charCount(Strin g str, int count) throws Exception
{
if (str != null) {
set(2, str.length());
}
}
}
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Hi!
Maybe something in the lines of:
VALUES(LENGTH(V ARGRAPHIC('YOUR _UNICODE_STRING ')))
Best regards,
Kovi
globomike wrote:
Hi,
I am looking for a function (or hint) how I can count unicode
characters (and not bytes) in DB2 V8.2.
In DB2 9 the length function is extenced with the codeunits32 option -
and this is exactly what I need in DB2 V8.2.
Can anybody help me with that?
Thanks in advance
kind regards
Michael
--
_______________ _____________
|http://kovica.blogspot .com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Hi Kovi,
thanks that is what I need.
I tried it before but somehow got an error - something like
incompatible datatypes for the function...
Now I tried it again after you posted that solution and it works!
Thanks again
kindregards
Michael
On Nov 14, 4:49 pm, Gregor Kova <gregor.ko...@m ikropis.siwrote :
Hi!
Maybe something in the lines of:
VALUES(LENGTH(V ARGRAPHIC('YOUR _UNICODE_STRING ')))
Best regards,
Kovi
globomike wrote:
Hi,
I am looking for a function (or hint) how I can count unicode
characters (and not bytes) in DB2 V8.2.
In DB2 9 the length function is extenced with the codeunits32 option -
and this is exactly what I need in DB2 V8.2.
Can anybody help me with that?
Thanks in advance
kind regards
Michael
--
_______________ _____________
|http://kovica.blogspot .com|
-----------------------------~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Zenobia |
last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice
features such as:
* rewrite source code
* check syntax
* global search & replace (through several files at once)
* regular expression search & replace.
Normally my documents are encoded with the ISO setting.
Recently I was writing an XHTML...
|
by: Michael Davis |
last post by:
Hi,
I've known C/C++ for years, but only ever used ascii strings. I have a
client who wants to know how gcc handles unicode. I've found the functions
utf8_mbtowc, utf8_mbstowcs, utf8_wctomb and utf8_wcstombs, but I'm
wondering if there are any other libraries or functions which can do things
like handle different kinds of encodings?
...
|
by: Ger |
last post by:
I have not been able to find a simple, straight forward Unicode to ASCII
string conversion function in VB.Net.
Is that because such a function does not exists or do I overlook it?
I found Encoding.Convert, but that needs byte arrays.
Thanks,
/Ger
|
by: chrisperkins99 |
last post by:
It seems to me that str.count is awfully slow. Is there some reason
for this?
Evidence:
######## str.count time test ########
import string
import time
import array
s = string.printable * int(1e5) # 10**7 character string
|
by: abhi147 |
last post by:
Hi ,
I want to convert an array of bytes like :
{79,104,-37,-66,24,123,30,-26,-99,-8,80,-38,19,14,-127,-3}
into Unicode character with ISO-8859-1 standard.
Can anyone help me .. how should I go about doing it ?
Thanks
| |
by: Preben Randhol |
last post by:
Hi
If I use len() on a string containing unicode letters I get the number
of bytes the string uses. This means that len() can report size 6 when
the unicode string only contains 3 characters (that one would write by
hand or see on the screen). Is there a way to calculate in characters
and not in bytes to represent the characters.
The...
|
by: willie |
last post by:
Martin v. Löwis:
Thanks for the thorough explanation. One last question
about terminology then I'll go away :)
What is the proper way to describe "ustr" below?
<type 'unicode'>
|
by: 7stud |
last post by:
Based on this example and the error:
-----
u_str = u"abc\u9999"
print u_str
UnicodeEncodeError: 'ascii' codec can't encode character u'\u9999' in
position 3: ordinal not in range(128)
------
|
by: mario |
last post by:
I have checks in code, to ensure a decode/encode cycle returns the
original string.
Given no UnicodeErrors, are there any cases for the following not to
be True?
unicode(s, enc).encode(enc) == s
mario
|
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...
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |