How to find charset of a string??
i pass an input thru a utf-8 encoded html form to a jsp. when i read it using bufferedreader and when i do request.getencoding( input text) it always shows me ISO8859_1, whether the data is english or japanese or any other language. how do i get the charset (SJIS or EUCJIS etc) of a text entered by the user in the html form???
thanks conner
i have one big problem here(hope you'll help)
my application takes in data from the user (multilingual data) and then submits it to a jsp which in turn inserts the data into a oracle db(UTF-8). the html form is UTF-8 and the content type of the JSP is UTF-8. the same jsp then retreives the data fromthe db and shows it onto a different htmlpage. the whole process is working fine i.e if i enter japanese text the jsp after retreiving from the db shows me the same data back on the browser. but when i check the contents of the db using SQL query it shows me SJIS encoded data. i think the data from the jsp to the db itself is getting changed into SJIS and to back this up i exported the data from the db into a text file there it showed me the equivalent inserts statements of the jsp but with SJIS data and not the data i entered.(hope you're getting my point here) what could be the problem here? one way i thought i could solve the problem was to use the SetCharacterEncoding(before accepting any data from the HTMlpage) method but this is available only in jsdk2.3 version . am i right to think that using this function would solve my problem? is there an alternative to this function ?
thanks
Similar Messages
-
How to find and replace any string between " "
Hi everyone,
Here my sample
String szTest;
szTest = "Yellow banana";
szTest = "Blue monkey";
szTest = "Red mango";
szTest is only needed when it's in testing progress. Now I want to put all of that in the /*comment*/ so the released program won't run those code any more (but still keep szTest so I can use it for future develop testing).
So Here what I want after using the Find and Replace Box:
//String szTest; //Manual
/*szTest = "Yellow banana";*/ //use find and replace
/*szTest = "Blue monkey";*/ //use find and replace
/*szTest = "Red mango";*/ //use find and replace
I think I can do this with Regular expressions or Wildcards. But I don't know how to find and replace any string between " and ".
Find: szTest = " ??Any string?? ";
Replace with: /*szTest = " ??Any string?? ";*/
Thanks for reading.Hi Nathan.j.Smith,
Based on your issue, I suggest you can try the Joel's suggestion check your issue again. In addition, I find a MSDN document about how to use the Regex.Replace Method to match a regular expression pattern with a specified replacement string,
maybe you will get some useful message.
https://msdn.microsoft.com/en-us/library/xwewhkd1(v=vs.110).aspx
If the above suggestion still could not provide you, could you please tell me what language you use to create the program for finding and replace any string using regular expression so that we will find the correct programming develop forum to support this
issue?
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to find number from text string??
Hi All,
Can you tell me how to find/ fetch number from string?
is there any function module for this.?
for example , I have string like "+++++1000000589+++"
and I need to fetch the invoice no 1000000589 from the above string..then How to do that? Letters may come first or number may come first and latter text...
Regards,
MrunalYou can do like this.
The below mentioned is code separate material
DO 18 TIMES.
LV_C = LV_C + 1.
LV_C1 = LV_C - 1.
IF GW_MATNR-MATNR+LV_C1(1) CN '0,1,2,3,4,5,6,7,8,9' .
IF ( ( LV_MAT EQ SPACE ) ) ." and ( lv_prefix eq space ) ) .
LV_PREFIX = 'X'.
CONCATENATE GW_TEMP-PREFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-PREFIX.
ELSE.
LV_SUFFIX = 'X'.
CONCATENATE GW_TEMP-SUFFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-SUFFIX.
ENDIF.
ELSEIF ( ( LV_SUFFIX EQ SPACE ) ) .
LV_MAT = 'X'.
CONCATENATE GW_TEMP-MATNR1 GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-MATNR1.
ELSEIF ( ( LV_MAT EQ 'X' ) ) .
CONCATENATE GW_TEMP-SUFFIX GW_MATNR-MATNR+LV_C1(1) INTO
GW_TEMP-SUFFIX.
ENDIF.
ENDDO. -
How to find out if a string is all alphabets
Hi,
How can I find out if a string contains all alphabets? Please help. Thanks.Hi,
How can I find out if a string contains all
all alphabets? Please help. Thanks. I am not sure if there's easier way. But this code should do what you want:
boolean bAlpha = true;
for (int i=0; i<str.length; i++)
if (!Character.isLetter(str.charAt(i))){
bAlpha = false;
break;
//bAlpha is true if str contains only alphabets. -
Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
shapes in Excel Object.
Since the Excel.Application
is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
interact with Excel document.
The figure below is an excel file:
Figure 1.
You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
$text = “text1”,”text2”,”text3”,”text3”
$Excel
= New-Object -ComObject Excel.Application
$Excel.visible = $true
$Workbook
= $Excel.workbooks.open("d:\shape.xlsx")
#Open the excel file
$Worksheet
= $Workbook.Worksheets.Item("shapes")
#Open the worksheet named "shapes"
$shape = $Worksheet.Shapes
# Get all the shapes
$i=0
# This number is used to replace the text in sequence as the variable “$text”
Foreach ($sh in $shape){
$sh.TextFrame.Characters().text
# Get the textbox in the shape
$sh.TextFrame.Characters().text =
$text[$i++]
#Change the value of the textbox in the shape one by one
$WorkBook.Save()
#Save workbook in excel
$WorkBook.Close()
#Close workbook in excel
[void]$excel.quit()
#Quit Excel
Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
Besides, we can also find the documents about these methods and properties in MSDN:
Workbook.Worksheets Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
Worksheet.Shapes Property:
http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
Shape.TextFrame Property:
http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
TextFrame.Characters Method (Excel):
http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
Characters.Text Property (Excel):
http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
After running the script above, we can see the changes in the figure below:
Figure 2.
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thank you for the information, but does this thread really need to be stuck to the top of the forum?
If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
EDIT: I see this is no longer stuck to the top of the forum, thank you.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
How to find a specific text(string) in a list (100) programs
Dear All,
Wish tou a very happy new year 2009!!!
please let me know how we can find a specific word(eg: "barrel") in a list of programs/reports/bdc/user exits/field exits/function modules.
Thanks in advance.
Kumar.hi kumar,
open EWK1 transaction and search for the word or string according to your requirement.
Cheers
Gautham -
How to find combinations of a string
Hi Dear,
How can we find the combination of a given string whatever input given by user.
If the String is A1C the possible outcomes are:
A1C
AC1
1CA
1AC
CA1
C1A
Best Regards,
AdityaPARAMETERS :
p_char(12) TYPE c. " Input character.
* Data declarations...................................................*
* Work variables *
DATA :
w_fact TYPE i " Factorial.
VALUE 1,
w_index TYPE i, " Index.
w_count TYPE i, " count.
w_str(40) TYPE c, " String.
w_str3(40) TYPE c, " String.
w_str2(40) TYPE c, " String.
w_temp TYPE c, " Temporary character.
w_i TYPE p, " Index outer.
w_j TYPE p, " Index inner.
w_flag TYPE i, " Flag variable.
w_len TYPE i. " Length.
w_str = p_char.
w_len = STRLEN( p_char ).
IF p_char IS INITIAL.
WRITE 'Enter any string'.
ELSE.
IF w_len < 7.
*Populating w_str and w_str2 with numbers-----------------------------*
DO w_len TIMES.
w_index = sy-index - 1.
w_count = w_len - sy-index.
w_fact = w_fact * sy-index.
w_str+w_index(1) = sy-index.
w_str2+w_count(1) = sy-index.
ENDDO. " DO w_len times.
w_i = w_str.
w_j = w_str2.
*Removing comma and spaces--------------------------------------------*
WRITE w_i TO w_str3 LEFT-JUSTIFIED.
TRANSLATE w_str3 USING ', '.
CONDENSE w_str3 NO-GAPS.
w_index = 0.
*While first number is less then last number--------------------------*
WHILE w_i <= w_j.
CLEAR w_str2.
WRITE w_i TO w_str LEFT-JUSTIFIED.
TRANSLATE w_str USING ', '.
CONDENSE w_str NO-GAPS.
DO w_len TIMES.
w_index = sy-index - 1.
*If w_str contains only digits from w_str3 then copy that digit into--*
*w_str2---------------------------------------------------------------*
IF w_str+w_index(1) CA w_str3.
w_str2+w_index(1) = w_str+w_index(1).
ELSE.
*Else set flag and exit from loop as it is not proper combination-----*
w_flag = 1.
EXIT.
ENDIF. " IF w_str+w_index(1) CA w_str3.
ENDDO. " DO w_len TIMES.
*If flag is zero check for repitation of digits-----------------------*
IF w_flag = 0.
DO w_len TIMES.
w_index = sy-index - 1.
FIND ALL OCCURRENCES OF w_str3+w_index(1)
IN w_str2 MATCH COUNT w_count.
*If digit repeats set flag and exit from loop-------------------------*
IF w_count > 1.
w_flag = 1.
EXIT.
ENDIF. " IF w_count > 1.
ENDDO. " DO w_len times.
ENDIF. " IF w_flag = 0.
*If flag is zero then replace digits with corresponding positions of--*
*real string----------------------------------------------------------*
IF w_flag = 0.
DO w_len TIMES.
w_index = sy-index - 1.
w_temp = w_str2+w_index(1) - 1.
w_str2+w_index(1) = p_char+w_temp(1).
ENDDO. " DO w_len TIMES.
WRITE :/ w_str2.
ENDIF. " IF w_flag = 0.
w_i = w_i + 1.
w_flag = 0.
ENDWHILE. " WHILE w_i <= w_j.
WRITE :
/ 'TOTAL ',
w_fact,
' combinations '.
ELSE.
WRITE :/ 'Enter shorter string.'.
ENDIF. " IF w_len < 10.
ENDIF. " IF p_char IS INITIAL. -
How to find out what a string contains?
I'm in the process of writing an XML parser for a project that I am working on. There will be one field in the XML that can be used to store an int, a date, or a string. I need to figure out a way to determine if that field contains an int, a date, or a string without modifying the XML at all. Meaning I can't just put an indicator in the XML itself. So given the string of data from the xml, how do I figure out what it is so that I can convert it to that type?
Any help would be appreciated as I don't have much time left to work on this.How are you going to be able to tell?
There will be one field
in the XML that can be used to store an int, a date,
or a string. "20010101" fits all three. In the absence of any other information, there's no way to tell what the sender meant the type to be.
Now, if you assume some formatting information, then you have a chance. Let's say that "dates" MUST be in the format "YYYY-mm-dd hh:MM:ss". Use SimpleDateFormat and Calendar and try to parse the string. If it works - it's a Date.
If it doesn't work - try to parse it as an Integer. If it works - it's an int.
If THAT doesn't work - give up and just use the String.
Does that help?
Grant -
How to find out whether the String contains chinese characters
I need to check if the string contains chinese characters in Java. Does anyone know how to do it? thx.
Since Java strings contain UNICODE code points, check the content against the relevant page here - http://www.unicode.org/charts/ .
-
How to find length of a string in JSF using EL expressions.
I am doing it as below for finding string length
<c:set var="test" value="#{myPageBean.myMethod.length()}" />
While evaluating the above expression,it will call getMyMethod() which will return a String. On that it will call length().
But it this throwing parsing error,
Is it different in JSF?..Pls help.BabuKhan wrote:
I have imported the taglib in th below 3 ways and tried
1. <anyxmlelement xmlns:fn="http://java.sun.com/jsp/jstl/functions" />
2. <anyxmlelement xmlns:fn="http://java.sun.com/jstl/functions" />
3. <anyxmlelement xmlns:fn="http://java.sun.com/jsf/functions" />
Literally? Do you understand the meaning of "anyxmlelement" ? -
How to find out index of string
Hi,
Can you help me to find out index of following strting.
"sss.xxxxx_pain.001.001.02_1002225618.xml"
need to get value "1002225618".
ideally i need to get the value inbetween after second "_" and value before ".xml".
Thanks
MahiHi Mahi,
UDF should be like this:
If you do not want .xml in the out replace statement
var1=var1.substring(sublen+1, len);
with
var1=var1.substring(sublen+1, len-4);
Regards,
Krupa -
How to find out the exact string in a single line?
Hi,
I have some data in table like below.
CERTTEST
CERT TEST
CERT
My requirement is fetch only CERT as a output.
Please share your thoughts.
ThanksNot sure what's the issue:
with t as (
select 'CERTTEST' str from dual union all
select 'CERT TEST' from dual union all
select 'CERT' from dual
-- end of data sample
select str
from t
where str = 'CERT'
STR
CERT
SQL> SY.
P.S. And if you need to seclect case insensitive CERT, use:
SQL> with t as (
2 select 'CERTTEST' str from dual union all
3 select 'CERT TEST' from dual union all
4 select 'CeRt' from dual union all
5 select 'CERT' from dual
6 )
7 -- end of data sample
8 select str
9 from t
10 where upper(str) = 'CERT'
11 /
STR
CeRt
CERT
SQL> -
How to find out if a string has 2 letters
I am making an app in which I am getting information from a date selector and if the selected date is, for example, 1, it needs to be 01, so I need to get a command that can tell if the text has 2 digits.
For example:
if (dateTime.Value.Month.ToString() == TwoDigits)
ToMonth_Text.Text = dateTime.Value.Month.ToString();
else
//Month for To Date
if (dateTime2.Value.Month.ToString() == "1")
ToMonth_Text.Text = "01";
if (dateTime2.Value.Month.ToString() == "2")
ToMonth_Text.Text = "02";
if (dateTime2.Value.Month.ToString() == "3")
ToMonth_Text.Text = "03";
//And so on....
Zack BowlingThanks, this worked for me. Here's my code I used for any future people who have the issue:
private void To_Closed(object sender, EventArgs e)
var dateTime2 = To_Text.Value;
ToMonth_Text.Text = dateTime2.Value.Month.ToString();
ToDay_Text.Text = dateTime2.Value.Day.ToString();
if (ToMonth_Text.Text.Length == 2)
ToMonth_Text.Text = dateTime2.Value.Month.ToString();
else
//Month for To Date
if (dateTime2.Value.Month.ToString() == "1")
ToMonth_Text.Text = "01";
if (dateTime2.Value.Month.ToString() == "2")
ToMonth_Text.Text = "02";
if (dateTime2.Value.Month.ToString() == "3")
ToMonth_Text.Text = "03";
if (ToDay_Text.Text.Length == 2)
ToDay_Text.Text = dateTime2.Value.Day.ToString();
else
//Day for To Date
if (dateTime2.Value.Day.ToString() == "1")
ToDay_Text.Text = "01";
if (dateTime2.Value.Day.ToString() == "2")
ToDay_Text.Text = "02";
if (dateTime2.Value.Day.ToString() == "3")
ToDay_Text.Text = "03";
Zack Bowling -
How to find the number of occurence of a string
String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
here i need to find the number of occurence of the string "experience".
how to find it out?String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
String findStr = "experience";
int count = 0;
int index = 0;
while(index != -1) {
index = str.indexOf(findStr, (count == 0 ? 0 : index + findStr.length()));
if(index != -1) {
count++; -
Hi
how to find length of a string.. i have a requirement that user cannot add more than 9 digits in a string.. i am new to WD Abap..
Regards,
PuneetHi,
You can use STRLEN command for your requirement.
First read your input field using code wizard.
Then using STRLEN command you can find the length of the Input field.
For Example :
Here input is your input field.
data : length type i.
length = strlen(input).
If length < 9.
raise error msg.
endif.
Edited by: Viji on Mar 26, 2008 11:30 AM
Maybe you are looking for
-
I am trying to toggle various switches based off of others and am wondering how I can go about this. For example, if switch A is on, B should toggle off. If I toggle B on, A should toggle off. Any help in doing this would be appreciated. Thanks.
-
Does Verizon have a download size limit like AT
I'm getting ready to buy a new iPad and was thinking of going with a Verizon unit. I don't like that AT&T limits the size of downloads on 3g and was wondering if Verizon did the same thing. Anyone know?
-
Cannot reverse an Invoice Distribution line
Hello gurus, I am not an expert with the payables module and I'm hoping someone can shed some light on this. I have an invoice with 20+ distribution lines. There is one line that doesn't not have the expenditure type populated but it has a project an
-
When I connect my ipad to the computer and click import photos and videos, the computer says that there are no photos or videos on the ipad it says the file is empty I can't even add anything to the file!!!!!
-
Sync Problem--Dont want to lose pics!
Hey Everyone: I recently formatted my hard drive and wiped out itunes with it. After re-installing itunes, I found out I cant access any music/photos. I didnt back up the photos on the PC before doing so because I figured the info is on the phone lik