3

I have a textBox. When I click mybtn if myTxtBox is empty a tooltip appears and give the message which attached to 'data-original-title'. It's working fine but when I add turkish charachters inside text instead of "Some text", these charachters are shown as a question mark.

$("#mybtn").on('click', function (e) {
if ($("#myTxtBox").val() == "") {
                MyTooltipCreator("#myTxtBox");
                $("#myTxtBox")
                    .attr('data-original-title', "Some text")
                    .tooltip('fixTitle')
                    .tooltip('show');
            }
 });

The strange thing is when I add my scripts inside my cshtml file it works very well. The problem occurs after I move my scripts into a seperate js file.

1
  • There can be several reasons behind this. What is document type? If you insert same Turkish character in plane <div> on page then does it shows? Does the font supports those Unicode characters? Commented Feb 10, 2017 at 11:32

1 Answer 1

7

If it is a static text then I think you need to change your js file Encoding Type.

Open your js file in Visual Studio. Click to "File" from top left corner. Then click to "Save as" your file. There is an arrow next to the "Save" button. Click to this arrow and select "Save with Encoding" and confirm the Save as process. In "Advanced Save Options" popup select Unicode(UTF-8) Encoding and click "OK".

Sign up to request clarification or add additional context in comments.

6 Comments

What do you mean?
How it will help?
you can set specific character encoding. it worked for me.
So you mean this line .attr('data-original-title', "TurikishCharacter") contains static text?
@Amit as in the sample, yes.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.