difference between string and string (full utf-8) in servicenow

Shilpi Sharma2
Tera Contributor

HI all,

 

Want to know the difference between string and string (full utf-8) in simple terms. Please help. 

2 REPLIES 2

Pooja Mallikarj
Kilo Sage

Hi,

Refer the below links it will provide you information about string and string(full utf-8)

https://community.servicenow.com/community?id=community_question&sys_id=b804c7e5dbd8dbc01dcaf3231f96...

 

Please mark correct/helpful if it helps for you.

Regards,

Pooja

Prins Kumar Gup
Giga Guru

Hi Shilpi,

Here some basic differences provided by the ServiceNow.

String: -

For 255 characters or less, the string field is a single-line text field. Anything 256 characters or over appears as a multi-line text box.

Note: The database may translate the value you provide in the Max length field to the closest matching database field type. For example, a max string length of 80 maps to the nearest database field type of VARCHAR(100).

For Oracle instances, users are not able to increase the max length of a string field to a value greater than 4000 through the application UI. Changes greater than 4000 require the CLOB data type in Oracle. If you require a field to be larger than 4000 characters, log an incident to request the change.

String (Full UTF-8): -

A string field that can contain. This field has the same restriction as the String data type as to maximum length that a user can define within the application UI. https://en.wikipedia.org/wiki/UTF-8

Here the example: - 

An abstract character string is one where Perl can recognize each grapheme cluster as a unit, and there is no encoding involved at the user level. Perl has to store these, but you don’t (shouldn’t) play with the string at that level.

UTF-8 encoded string is one where the octets in the string are the same as in the UTF-8 representation. Perl sees a string of octets and cannot recognize grapheme clusters.

Consider this example. In

use v5.14;
use utf8;


# # # Abstract character string
my $char_string = 'Büster';

say "Length of char string is ", length $char_string; #6
say join " ", map { sprintf '%X', ord } split //, $char_string;


# # # UTF-8–encoded octet string
open my $fh, '>:utf8', \my $utf8_string;
print $fh $char_string;
close $fh;

say "Length of utf8 string is ", length $utf8_string; # 7
say join " ", map { sprintf '%X', ord } split //, $utf8_string;

The output shows that the same are two are different things because one is a string of characters and one a string of octets:

use v5.14;
use utf8;


# # # Abstract character string
my $char_string = 'Büster';

say "Length of char string is ", length $char_string; #6
say join " ", map { sprintf '%X', ord } split //, $char_string;


# # # UTF-8 encoded octet string
open my $fh, '>:utf8', \my $utf8_string;
print $fh $char_string;
close $fh;

say "Length of utf8 string is ", length $utf8_string; # 7
say join " ", map { sprintf '%X', ord } split //, $utf8_string;

The output shows the difference. In the character string, the Ã¼ shows up as the single character with code number 0xFC. In the UTF-8 version, the code number 0xFC is represented as 0xC3 0xBC. Since this is just a string of octets, Perl thinks that this version is one character longer:

Length of char string is 6
42 FC 73 74 65 72
Length of utf8 string is 7
42 C3 BC 73 74 65 72

Thanks,

PKG