Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:54:47+00:00 2026-06-11T12:54:47+00:00

I am reading a text file . and then splitting it into by 100

  • 0

I am reading a text file . and then splitting it into by 100 words in an array named “$arrpg” and then in my js code while i am loading it to js variable , the var is unable to get the array values properly. if you don’t mind please see a link where i uploaded it for test purpose (link)

here my input text file is ”

A MUSICISTA E O GUERREIRO
À noite, deitado, no escuro, não tenho forças para evitar o concerto da virtuose muriçoca. Ela vem dali até aqui na velocidade do som. Procuro capturá-la com a mão, ela — vivace — ………………………so many more

“

my js code is

    <script type="text/javascript" charset="UTF-8">


$(document).ready(function() {




    var ind=0;
   var tempv1;
   var tempv2;


    var pages=<?php echo json_encode((int)($page_num));?>;

    var jsarr= <?php echo json_encode($arrpg); ?>;


    var wmap=<?php 

    echo json_encode($word_map); ?>;
    var myurl=<?php echo json_encode($my_link.'write_comment/'.$file_name.'/'.$total_word.'/');?>











     $('.more').each(function() {



        pages++;

           $(this).html(jsarr[ind]);

        tempv2= ' <a class="link2" href="'+myurl+wmap[0]  + '">';


        if(pages!==1)
        {

            tempv1='<span>.... <a href=""class="link1">Read more</a></span>';
            tempv2='<br><br>'+tempv2+'Stop reading</a>';
            $('div.link1').html(tempv1);
            $('div.link2').html(tempv2);


        }
        else
        {


            tempv2='<br><br>'+tempv2+'Please a feedback</a>';

            $('div.link2').html(tempv2);


        }





            scroll();









        });   


    $(".link1").click(function(){


        ind++;


        $('div.more').append(jsarr[ind]);



        tempv2= '<a class="link2" href="'+myurl+wmap[ind]  + '">';

        if(ind<(pages-1) )
        {
            tempv1='<span>.... <a href=""class="link1">Read more</a></span>';
            tempv2='<br><br>'+tempv2+'Stop reading</a>';


            $('div.link1').html(tempv1);
            $('div.link2').html(tempv2);

        }
        else 
        {
            tempv2='<br><br>'+tempv2+'Please a feedback</a>';

            tempv1='';
            $('div.link1').html(tempv1);







            $('div.link2').html(tempv2);


        }



        scroll();

        return false;
    });
});



            function scroll(){
  $('html, body').animate({
    scrollTop: $("#ft").offset().top
  }, 0);
}



</script>

in this code declaration of jsarr can’t get the values properly. seeing the link u will realize more. please help.

after 1st edit

`<script type="text/javascript" charset="UTF-8">


$(document).ready(function() {




    var ind=0;
   var tempv1;
   var tempv2;


    var pages=5;

    var jsarr= [" A MUSICISTA E O GUERREIRO\r\n"," a m"," agudo violino. Cubro a\\norelha, sinto calor, descubro a orelha, escuto a muri"," da habilidosa\\ninstrumentista. Na manh"," palmas de\\nminhas m"," morta, rubronegra\\n-- na plan"];
    alert(jsarr);

    var wmap=[30,60,90,120,150,175];
    var myurl="http:\/\/leiame.patio.com.br\/read\/write_comment\/muricoca\/175\/"  











     $('.more').each(function() {



        pages++;

           $(this).html(jsarr[0]);

        tempv2= ' <a class="link2" href="'+myurl+wmap[0]  + '">';


        if(pages!==1)
        {

            tempv1='<span>.... <a href=""class="link1">Read more</a></span>';
            tempv2='<br><br>'+tempv2+'Stop reading</a>';
            $('div.link1').html(tempv1);
            $('div.link2').html(tempv2);


        }
        else
        {


            tempv2='<br><br>'+tempv2+'Please a feedback</a>';

            $('div.link2').html(tempv2);


        }





            scroll();









        });   


    $(".link1").click(function(){


        ind++;


        $('div.more').append(jsarr[ind]);



        tempv2= '<a class="link2" href="'+myurl+wmap[ind]  + '">';

        if(ind<(pages-1) )
        {
            tempv1='<span>.... <a href=""class="link1">Read more</a></span>';
            tempv2='<br><br>'+tempv2+'Stop reading</a>';


            $('div.link1').html(tempv1);
            $('div.link2').html(tempv2);

        }
        else 
        {
            tempv2='<br><br>'+tempv2+'Please a feedback</a>';

            tempv1='';
            $('div.link1').html(tempv1);







            $('div.link2').html(tempv2);


        }



        scroll();

        return false;
    });
});



            function scroll(){
  $('html, body').animate({
    scrollTop: $("#ft").offset().top
  }, 0);
}



</script>`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:54:48+00:00Added an answer on June 11, 2026 at 12:54 pm

    json_encode has some trouble with non utf8 chars.

    the string parsing within json encode is then stopped at the first non utf8 char found.

    so i would suggest:

    utf8_encode each value in $arrpg before submitting to json_encode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code reading a text file and scanning for words between brackets:
I am reading in from a text file using StreamReader into a string array
I am reading a text file which contains numbers in the range [1, 10^100].
I am reading and writting a structure into a text file which is not
I'm reading lines form in a text file and then performing actions per line.
Hi experts I'm looking to make a loop of reading a text file then
When reading from a text file, one typically creates a FileReader and then nests
I'm reading in a text file using BinaryReader, then doing what I want with
In C#, I am reading insert SQL statements from a text file and then
I am reading text from a file into a string builder, I make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.